[chronojump] At database import can easily import again from new/same .db file



commit b532f0026ffa87b39e4a18e691f77f98883506ae
Author: Xavier de Blas <xaviblas gmail com>
Date:   Mon Oct 21 18:58:12 2019 +0200

    At database import can easily import again from new/same .db file

 glade/session_load.glade | 103 +++++++++++++++++++++++++++++++++--------------
 src/gui/session/load.cs  |  11 ++++-
 2 files changed, 83 insertions(+), 31 deletions(-)
---
diff --git a/glade/session_load.glade b/glade/session_load.glade
index 6cc78998..5af9afc0 100644
--- a/glade/session_load.glade
+++ b/glade/session_load.glade
@@ -21,7 +21,6 @@
           <widget class="GtkNotebook" id="notebook_import">
             <property name="visible">True</property>
             <property name="can_focus">True</property>
-            <property name="show_tabs">False</property>
             <property name="show_border">False</property>
             <child>
               <widget class="GtkVBox" id="session_import_box">
@@ -109,15 +108,26 @@
                     <property name="can_focus">False</property>
                     <property name="layout_style">spread</property>
                     <child>
-                      <widget class="GtkButton" id="button_cancel0">
-                        <property name="label">gtk-cancel</property>
+                      <widget class="GtkVBox" id="vbox12">
                         <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_cancel0_clicked" swapped="no"/>
-                        <accelerator key="Escape" signal="clicked"/>
+                        <property name="can_focus">False</property>
+                        <child>
+                          <widget class="GtkButton" id="button_cancel0">
+                            <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_cancel0_clicked" swapped="no"/>
+                            <accelerator key="Escape" signal="clicked"/>
+                          </widget>
+                          <packing>
+                            <property name="expand">True</property>
+                            <property name="fill">False</property>
+                            <property name="position">0</property>
+                          </packing>
+                        </child>
                       </widget>
                       <packing>
                         <property name="expand">False</property>
@@ -126,41 +136,74 @@
                       </packing>
                     </child>
                     <child>
-                      <widget class="GtkButton" id="select_file_import">
+                      <widget class="GtkVBox" id="vbox11">
                         <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="spacing">20</property>
                         <child>
-                          <widget class="GtkHBox" id="hbox2">
+                          <widget class="GtkButton" id="button_select_file_import_same_database">
                             <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="spacing">8</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">True</property>
+                            <property name="tooltip" translatable="yes">Import from already opened 
database</property>
+                            <signal name="clicked" 
handler="on_button_select_file_import_same_database_clicked" swapped="no"/>
                             <child>
-                              <widget class="GtkImage" id="image_open_database">
+                              <widget class="GtkLabel" id="label14">
                                 <property name="visible">True</property>
                                 <property name="can_focus">False</property>
-                                <property name="stock">gtk-missing-image</property>
+                                <property name="label" translatable="yes">Use same database</property>
                               </widget>
-                              <packing>
-                                <property name="expand">True</property>
-                                <property name="fill">True</property>
-                                <property name="position">0</property>
-                              </packing>
                             </child>
+                          </widget>
+                          <packing>
+                            <property name="expand">True</property>
+                            <property name="fill">False</property>
+                            <property name="position">0</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <widget class="GtkButton" id="button_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_button_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="label_open_database_file">
+                                    <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">True</property>
+                            <property name="position">1</property>
+                          </packing>
                         </child>
                       </widget>
                       <packing>
diff --git a/src/gui/session/load.cs b/src/gui/session/load.cs
index f3b402b0..183bc411 100644
--- a/src/gui/session/load.cs
+++ b/src/gui/session/load.cs
@@ -60,6 +60,8 @@ public class SessionLoadWindow
        [Widget] Gtk.RadioButton radio_import_new_session;
        [Widget] Gtk.RadioButton radio_import_current_session;
        [Widget] Gtk.Image image_open_database;
+       [Widget] Gtk.Label label_open_database_file;
+       [Widget] Gtk.Button button_select_file_import_same_database;
 
        //notebook import tab 1
        [Widget] Gtk.TreeView treeview_session_load;
@@ -119,6 +121,7 @@ public class SessionLoadWindow
                        hbuttonbox_page1_load.Visible = false;
                        hbuttonbox_page1_import.Visible = true;
                        session_load.Title = Catalog.GetString ("Import session");
+                       button_select_file_import_same_database.Visible = false; //is shown when user want to 
import a second session
                        notebook_import.CurrentPage = PAGE_IMPORT_START;
                }
 
@@ -558,9 +561,12 @@ public class SessionLoadWindow
                */
                fakeButton_cancel_maybeDatabaseSwitched.Click();
        }
-       protected void on_select_file_import_clicked(object o, EventArgs args) {
+       protected void on_button_select_file_import_clicked(object o, EventArgs args) {
                chooseDatabaseToImport ();
        }
+       protected void on_button_select_file_import_same_database_clicked(object o, EventArgs args) {
+               notebook_import.CurrentPage = PAGE_SELECT_SESSION;
+       }
 
        //import notebook page 1 (load sesion) buttons
        void on_button_cancel1_clicked (object o, EventArgs args)
@@ -633,6 +639,9 @@ public class SessionLoadWindow
                label_import_done_at_current_session.Visible = false;
                scrolledwindow_import_error.Visible = false;
 
+               label_open_database_file.Text = Catalog.GetString("Open another database");
+               button_select_file_import_same_database.Visible = true;
+
                notebook_import.CurrentPage = PAGE_IMPORT_START;
        }
 


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