[chronojump] Added link to logs directory on preferences



commit da965311f5dd930208024e5d63876b5715dbab4e
Author: Xavier de Blas <xaviblas gmail com>
Date:   Fri Jun 27 11:07:12 2014 +0200

    Added link to logs directory on preferences

 glade/chronojump.glade |  108 +++++++++++++++++++++++++++++-------------------
 src/constants.cs       |    3 +-
 src/gui/preferences.cs |   16 ++++++-
 src/util.cs            |    4 ++
 4 files changed, 86 insertions(+), 45 deletions(-)
---
diff --git a/glade/chronojump.glade b/glade/chronojump.glade
index 4e94055..d198f3e 100644
--- a/glade/chronojump.glade
+++ b/glade/chronojump.glade
@@ -6204,6 +6204,9 @@ Second Chronopic to platforms.</property>
                                                         <child>
                                                           <placeholder/>
                                                         </child>
+                                                        <child>
+                                                          <placeholder/>
+                                                        </child>
                                                       </widget>
                                                       <packing>
                                                         <property name="expand">True</property>
@@ -6832,6 +6835,9 @@ Second Chronopic to platforms.</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             </child>
                                                             <child>
@@ -7594,6 +7600,9 @@ Second Chronopic to platforms.</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="position">2</property>
@@ -8115,6 +8124,9 @@ Second Chronopic to platforms.</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="position">4</property>
@@ -17364,6 +17376,9 @@ by you</property>
                         <child>
                           <placeholder/>
                         </child>
+                        <child>
+                          <placeholder/>
+                        </child>
                       </widget>
                     </child>
                   </widget>
@@ -17790,6 +17805,9 @@ by you</property>
                         <child>
                           <placeholder/>
                         </child>
+                        <child>
+                          <placeholder/>
+                        </child>
                       </widget>
                     </child>
                   </widget>
@@ -18656,6 +18674,12 @@ by you</property>
             <child>
               <placeholder/>
             </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
           </widget>
           <packing>
             <property name="expand">True</property>
@@ -26257,6 +26281,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>
@@ -28072,6 +28114,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>
@@ -28557,6 +28602,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>
@@ -28859,50 +28907,17 @@ To differentiate between male and female, use the values 1/0, or m/f, or M/F on
                   </packing>
                 </child>
                 <child>
-                  <widget class="GtkVBox" id="vbox145">
-                    <property name="can_focus">False</property>
-                    <property name="border_width">8</property>
-                    <property name="spacing">10</property>
-                    <child>
-                      <widget class="GtkVBox" id="vbox146">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="spacing">6</property>
-                        <child>
-                          <widget class="GtkLabel" id="label531">
-                            <property name="can_focus">False</property>
-                            <property name="label">Logs directory</property>
-                            <property name="use_markup">True</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_logs">
-                            <property name="can_focus">True</property>
-                            <property name="selectable">True</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">False</property>
-                        <property name="fill">True</property>
-                        <property name="padding">4</property>
-                        <property name="position">0</property>
-                      </packing>
-                    </child>
+                  <widget class="GtkButton" id="button_logs_folder_open">
+                    <property name="label" translatable="yes">Open logs folder</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">False</property>
+                    <property name="use_underline">True</property>
+                    <signal name="clicked" handler="on_button_logs_folder_open_clicked" swapped="no"/>
                   </widget>
                   <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">True</property>
+                    <property name="expand">True</property>
+                    <property name="fill">False</property>
                     <property name="position">1</property>
                   </packing>
                 </child>
@@ -30557,6 +30572,9 @@ show elevation as:</property>
                         <child>
                           <placeholder/>
                         </child>
+                        <child>
+                          <placeholder/>
+                        </child>
                       </widget>
                       <packing>
                         <property name="left_attach">2</property>
@@ -30647,6 +30665,9 @@ show elevation as:</property>
                     <child>
                       <placeholder/>
                     </child>
+                    <child>
+                      <placeholder/>
+                    </child>
                   </widget>
                 </child>
               </widget>
@@ -30752,6 +30773,9 @@ show elevation as:</property>
                     <child>
                       <placeholder/>
                     </child>
+                    <child>
+                      <placeholder/>
+                    </child>
                   </widget>
                 </child>
               </widget>
diff --git a/src/constants.cs b/src/constants.cs
index 896fe76..a13c87c 100644
--- a/src/constants.cs
+++ b/src/constants.cs
@@ -568,7 +568,8 @@ public class Constants
                Catalog.GetString("Preparing main Window"),     //6
        };
        
-       public static string DatabaseNotFound = Catalog.GetString("Error. Cannot find database");
+       public static string DatabaseNotFound = Catalog.GetString("Error. Cannot find database.");
+       public static string LogNotFound = Catalog.GetString("Error. Cannot find logs directory.");
 
        public static string ChronopicDefaultPortWindows = "COM?";
        public static string ChronopicDefaultPortLinux = "/dev/ttyUSB?";
diff --git a/src/gui/preferences.cs b/src/gui/preferences.cs
index 0ffd3b3..2ba2ec8 100644
--- a/src/gui/preferences.cs
+++ b/src/gui/preferences.cs
@@ -36,7 +36,6 @@ public class PreferencesWindow {
 
        [Widget] Gtk.Label label_database;
        [Widget] Gtk.Label label_database_temp;
-       [Widget] Gtk.Label label_logs;
        
        [Widget] Gtk.Button button_db_folder_open;
 
@@ -121,7 +120,6 @@ public class PreferencesWindow {
                //database and log files stuff
                label_database.Text = Util.GetDatabaseDir() + System.IO.Path.DirectorySeparatorChar  + 
"chronojump.db";
                label_database_temp.Text = Util.GetDatabaseTempDir() + System.IO.Path.DirectorySeparatorChar  
+ "chronojump.db";
-               //label_logs.Text = Log.GetDir();
        }
        
        static public PreferencesWindow Show (int digitsNumber, bool showHeight, bool showPower,  
@@ -364,6 +362,20 @@ public class PreferencesWindow {
        void on_check_backup_encoder_tests_clicked(object o, EventArgs args) {
                check_backup_multimedia.Active = check_backup_encoder_tests.Active;
        }       
+       
+       
+       void on_button_logs_folder_open_clicked (object o, EventArgs args)
+       {
+               string dir = Util.GetLogsDir();
+               Log.WriteLine(dir);
+
+               if(new System.IO.DirectoryInfo(dir).Exists)
+                       System.Diagnostics.Process.Start(dir); 
+               else
+                       new DialogMessage(Constants.MessageTypes.WARNING, 
+                                       Constants.LogNotFound + "\n\n" + dir);
+       }
+
 
 
        string fileDB;
diff --git a/src/util.cs b/src/util.cs
index 0d22e30..72c3f0c 100644
--- a/src/util.cs
+++ b/src/util.cs
@@ -734,6 +734,10 @@ public class Util
 
        /********** end of database paths ************/
        
+       public static string GetLogsDir() {
+               return Path.Combine(Path.GetTempPath(), "Chronojump-logs");
+       }
+
        /********** start of multimedia paths ************/
 
        public static string GetMultimediaDir() {


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