[chronojump/chronojump-importer] When importing another chronojump session: adds a button to open the file dialog.



commit f828d3b01bfbfba1f7a176781367ad160f244ac3
Author: Carles Pina i Estany <carles pina cat>
Date:   Tue Sep 13 20:57:05 2016 +0100

    When importing another chronojump session: adds a button to open the file dialog.

 glade/chronojump.glade |  136 ++++++++++++++++++++++++++++++++++++++++-------
 src/gui/session.cs     |   31 +++++++++---
 2 files changed, 139 insertions(+), 28 deletions(-)
---
diff --git a/glade/chronojump.glade b/glade/chronojump.glade
index 737c385..c5f2ca1 100644
--- a/glade/chronojump.glade
+++ b/glade/chronojump.glade
@@ -17966,6 +17966,9 @@ Concentric</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
@@ -22784,6 +22787,9 @@ by you</property>
                         <child>
                           <placeholder/>
                         </child>
+                        <child>
+                          <placeholder/>
+                        </child>
                       </widget>
                     </child>
                   </widget>
@@ -24083,6 +24089,9 @@ by you</property>
                         <child>
                           <placeholder/>
                         </child>
+                        <child>
+                          <placeholder/>
+                        </child>
                       </widget>
                     </child>
                   </widget>
@@ -25874,6 +25883,9 @@ by you</property>
               <placeholder/>
             </child>
             <child>
+              <placeholder/>
+            </child>
+            <child>
               <widget class="GtkButton" id="button_video_url">
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
@@ -26722,6 +26734,9 @@ by you</property>
             <child>
               <placeholder/>
             </child>
+            <child>
+              <placeholder/>
+            </child>
           </widget>
           <packing>
             <property name="expand">True</property>
@@ -40044,6 +40059,24 @@ options</property>
                             <child>
                               <placeholder/>
                             </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
                           </widget>
                         </child>
                       </widget>
@@ -43203,6 +43236,18 @@ To differentiate between male and female, use the values 1/0, or m/f, or M/F on
                     <child>
                       <placeholder/>
                     </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
                   </widget>
                 </child>
               </widget>
@@ -44329,9 +44374,6 @@ To differentiate between male and female, use the values 1/0, or m/f, or M/F on
                                       <placeholder/>
                                     </child>
                                     <child>
-                                      <placeholder/>
-                                    </child>
-                                    <child>
                                       <widget class="GtkLabel" id="label218">
                                         <property name="visible">True</property>
                                         <property name="can_focus">False</property>
@@ -45630,6 +45672,9 @@ To differentiate between male and female, use the values 1/0, or m/f, or M/F on
                                     <child>
                                       <placeholder/>
                                     </child>
+                                    <child>
+                                      <placeholder/>
+                                    </child>
                                   </widget>
                                 </child>
                               </widget>
@@ -50512,6 +50557,9 @@ Other</property>
                         <child>
                           <placeholder/>
                         </child>
+                        <child>
+                          <placeholder/>
+                        </child>
                       </widget>
                       <packing>
                         <property name="left_attach">2</property>
@@ -51475,6 +51523,9 @@ Other</property>
                     <child>
                       <placeholder/>
                     </child>
+                    <child>
+                      <placeholder/>
+                    </child>
                   </widget>
                 </child>
               </widget>
@@ -52453,6 +52504,9 @@ Other</property>
                     <child>
                       <placeholder/>
                     </child>
+                    <child>
+                      <placeholder/>
+                    </child>
                   </widget>
                 </child>
               </widget>
@@ -58741,6 +58795,61 @@ suitable for agility tests and RSA)</property>
           </packing>
         </child>
         <child>
+          <widget class="GtkHBox" id="session_import_box">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <child>
+              <widget class="GtkLabel" id="file_label">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label" translatable="yes">Path:</property>
+              </widget>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkEntry" id="file_path_import">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="invisible_char">●</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_file_path_import_changed" swapped="no"/>
+              </widget>
+              <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkButton" id="select_file_import">
+                <property name="label">gtk-open</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_stock">True</property>
+                <signal name="clicked" handler="on_select_file_import_clicked" swapped="no"/>
+              </widget>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">2</property>
+              </packing>
+            </child>
+          </widget>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</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>
@@ -58757,7 +58866,7 @@ suitable for agility tests and RSA)</property>
           <packing>
             <property name="expand">True</property>
             <property name="fill">True</property>
-            <property name="position">1</property>
+            <property name="position">2</property>
           </packing>
         </child>
         <child>
@@ -58802,26 +58911,11 @@ suitable for agility tests and RSA)</property>
           <packing>
             <property name="expand">False</property>
             <property name="fill">True</property>
-            <property name="position">2</property>
+            <property name="position">3</property>
           </packing>
         </child>
         <child>
-          <widget class="GtkEntry" id="entry_path">
-            <property name="visible">True</property>
-            <property name="can_focus">True</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_path_changed" swapped="no"/>
-          </widget>
-          <packing>
-            <property name="expand">True</property>
-            <property name="fill">True</property>
-            <property name="position">3</property>
-          </packing>
+          <placeholder/>
         </child>
       </widget>
     </child>
diff --git a/src/gui/session.cs b/src/gui/session.cs
index 4d33425..71d5a9e 100644
--- a/src/gui/session.cs
+++ b/src/gui/session.cs
@@ -661,7 +661,9 @@ public class SessionLoadWindow {
        [Widget] Gtk.Entry entry_search_filter;
        [Widget] Gtk.CheckButton checkbutton_show_data_jump_run;
        [Widget] Gtk.CheckButton checkbutton_show_data_encoder;
-       [Widget] Gtk.Entry entry_path;
+       [Widget] Gtk.Entry file_path_import;
+       [Widget] Gtk.Button select_file_import;
+       [Widget] Gtk.HBox session_import_box;
 
        static SessionLoadWindow SessionLoadWindowBox;
        Gtk.Window parent;
@@ -677,7 +679,7 @@ public class SessionLoadWindow {
                gladeXML.Autoconnect(this);
                this.parent = parent;
 
-               entry_path.Visible = (type == WindowType.IMPORT_SESSION);
+               session_import_box.Visible = (type == WindowType.IMPORT_SESSION);
 
                //put an icon to window
                UtilGtk.IconWindow(session_load);
@@ -775,8 +777,24 @@ public class SessionLoadWindow {
        protected void on_entry_search_filter_changed (object o, EventArgs args) {
                recreateTreeView("changed search filter");
        }
-       protected void on_entry_path_changed(object o, EventArgs args) {
-               recreateTreeView ("entry path changed");
+       protected void on_file_path_import_changed(object o, EventArgs args) {
+               recreateTreeView ("file path changed");
+       }
+       protected void on_select_file_import_clicked(object o, EventArgs args) {
+               Gtk.FileChooserDialog filechooser = new Gtk.FileChooserDialog ("Choose ChronoJump database to 
import from",
+                                                                              session_load, 
FileChooserAction.Open,
+                                                                              "Cancel",ResponseType.Cancel,
+                                                                              "Open",ResponseType.Accept);
+
+               FileFilter file_filter = new FileFilter();
+               file_filter.AddPattern ("*.db");
+               file_filter.Name = "ChronoJump database";
+               filechooser.AddFilter (file_filter);
+
+               if (filechooser.Run () == (int)ResponseType.Accept) {
+                       file_path_import.Text = filechooser.Filename;
+               }
+               filechooser.Destroy ();
        }
        void on_checkbutton_show_data_jump_run_toggled (object o, EventArgs args) {
                recreateTreeView("jump run " + checkbutton_show_data_jump_run.Active.ToString());
@@ -811,7 +829,7 @@ public class SessionLoadWindow {
                if(entry_search_filter.Text.ToString().Length > 0) 
                        filterName = entry_search_filter.Text.ToString();
 
-               SqliteSessionSwitcher sessionSwitcher = new SqliteSessionSwitcher (entry_path.Text.ToString 
());
+               SqliteSessionSwitcher sessionSwitcher = new SqliteSessionSwitcher (file_path_import.Text);
                
                string [] mySessions = sessionSwitcher.SelectAllSessions(filterName); //returns a string of 
values separated by ':'
                foreach (string session in mySessions) {
@@ -932,7 +950,7 @@ public class SessionLoadWindow {
        }
 
        public string DatabasePath() {
-               return entry_path.Text;
+               return file_path_import.Text;
        }
        
        void on_row_double_clicked (object o, Gtk.RowActivatedArgs args)
@@ -1026,7 +1044,6 @@ public class SessionSelectStatsWindow {
                        SessionSelectStatsWindowBox = new SessionSelectStatsWindow (parent, 
oldSelectedSessions);
                }
                SessionSelectStatsWindowBox.stats_select_sessions.Show ();
-               
                return SessionSelectStatsWindowBox;
        }
        


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