[chronojump] More force sensor preferences GUI



commit d4f2b42d9a57e42c733f7e4165d16c12fb690dd0
Author: Xavier de Blas <xaviblas gmail com>
Date:   Thu Apr 20 17:48:25 2017 +0200

    More force sensor preferences GUI

 glade/preferences_win.glade |  176 +++++++++++++------------------------------
 src/gui/preferences.cs      |   33 +++------
 2 files changed, 64 insertions(+), 145 deletions(-)
---
diff --git a/glade/preferences_win.glade b/glade/preferences_win.glade
index d5c4de1..8c6e23f 100644
--- a/glade/preferences_win.glade
+++ b/glade/preferences_win.glade
@@ -2950,7 +2950,7 @@ Fitted</property>
                                       </packing>
                                     </child>
                                     <child>
-                                      <widget class="GtkHBox" id="hbox_force_1_from">
+                                      <widget class="GtkHBox" id="hbox_force_1_from_to">
                                         <property name="visible">True</property>
                                         <property name="can_focus">False</property>
                                         <property name="spacing">6</property>
@@ -2988,39 +2988,15 @@ Fitted</property>
                                           </packing>
                                         </child>
                                         <child>
-                                          <widget class="GtkLabel" id="label87">
-                                            <property name="visible">True</property>
-                                            <property name="can_focus">False</property>
-                                            <property name="label">ms</property>
-                                          </widget>
-                                          <packing>
-                                            <property name="expand">True</property>
-                                            <property name="fill">True</property>
-                                            <property name="position">2</property>
-                                          </packing>
-                                        </child>
-                                      </widget>
-                                      <packing>
-                                        <property name="expand">False</property>
-                                        <property name="fill">False</property>
-                                        <property name="position">4</property>
-                                      </packing>
-                                    </child>
-                                    <child>
-                                      <widget class="GtkHBox" id="hbox_force_1_to">
-                                        <property name="visible">True</property>
-                                        <property name="can_focus">False</property>
-                                        <property name="spacing">6</property>
-                                        <child>
                                           <widget class="GtkLabel" id="label_force_1_to">
                                             <property name="visible">True</property>
                                             <property name="can_focus">False</property>
-                                            <property name="label">To</property>
+                                            <property name="label">to</property>
                                           </widget>
                                           <packing>
                                             <property name="expand">False</property>
                                             <property name="fill">False</property>
-                                            <property name="position">0</property>
+                                            <property name="position">2</property>
                                           </packing>
                                         </child>
                                         <child>
@@ -3041,7 +3017,7 @@ Fitted</property>
                                           <packing>
                                             <property name="expand">False</property>
                                             <property name="fill">False</property>
-                                            <property name="position">1</property>
+                                            <property name="position">3</property>
                                           </packing>
                                         </child>
                                         <child>
@@ -3053,14 +3029,14 @@ Fitted</property>
                                           <packing>
                                             <property name="expand">True</property>
                                             <property name="fill">True</property>
-                                            <property name="position">2</property>
+                                            <property name="position">4</property>
                                           </packing>
                                         </child>
                                       </widget>
                                       <packing>
                                         <property name="expand">False</property>
                                         <property name="fill">False</property>
-                                        <property name="position">5</property>
+                                        <property name="position">4</property>
                                       </packing>
                                     </child>
                                   </widget>
@@ -3275,7 +3251,7 @@ Fitted</property>
                                       </packing>
                                     </child>
                                     <child>
-                                      <widget class="GtkHBox" id="hbox_force_2_from">
+                                      <widget class="GtkHBox" id="hbox_force_2_from_to">
                                         <property name="visible">True</property>
                                         <property name="can_focus">False</property>
                                         <property name="spacing">6</property>
@@ -3313,39 +3289,15 @@ Fitted</property>
                                           </packing>
                                         </child>
                                         <child>
-                                          <widget class="GtkLabel" id="label91">
-                                            <property name="visible">True</property>
-                                            <property name="can_focus">False</property>
-                                            <property name="label">ms</property>
-                                          </widget>
-                                          <packing>
-                                            <property name="expand">True</property>
-                                            <property name="fill">True</property>
-                                            <property name="position">2</property>
-                                          </packing>
-                                        </child>
-                                      </widget>
-                                      <packing>
-                                        <property name="expand">False</property>
-                                        <property name="fill">False</property>
-                                        <property name="position">4</property>
-                                      </packing>
-                                    </child>
-                                    <child>
-                                      <widget class="GtkHBox" id="hbox_force_2_to">
-                                        <property name="visible">True</property>
-                                        <property name="can_focus">False</property>
-                                        <property name="spacing">6</property>
-                                        <child>
                                           <widget class="GtkLabel" id="label_force_2_to">
                                             <property name="visible">True</property>
                                             <property name="can_focus">False</property>
-                                            <property name="label">To</property>
+                                            <property name="label">to</property>
                                           </widget>
                                           <packing>
                                             <property name="expand">False</property>
                                             <property name="fill">False</property>
-                                            <property name="position">0</property>
+                                            <property name="position">2</property>
                                           </packing>
                                         </child>
                                         <child>
@@ -3366,11 +3318,11 @@ Fitted</property>
                                           <packing>
                                             <property name="expand">False</property>
                                             <property name="fill">False</property>
-                                            <property name="position">1</property>
+                                            <property name="position">3</property>
                                           </packing>
                                         </child>
                                         <child>
-                                          <widget class="GtkLabel" id="label92">
+                                          <widget class="GtkLabel" id="label91">
                                             <property name="visible">True</property>
                                             <property name="can_focus">False</property>
                                             <property name="label">ms</property>
@@ -3378,14 +3330,14 @@ Fitted</property>
                                           <packing>
                                             <property name="expand">True</property>
                                             <property name="fill">True</property>
-                                            <property name="position">2</property>
+                                            <property name="position">4</property>
                                           </packing>
                                         </child>
                                       </widget>
                                       <packing>
                                         <property name="expand">False</property>
                                         <property name="fill">False</property>
-                                        <property name="position">5</property>
+                                        <property name="position">4</property>
                                       </packing>
                                     </child>
                                   </widget>
@@ -3600,7 +3552,7 @@ Fitted</property>
                                       </packing>
                                     </child>
                                     <child>
-                                      <widget class="GtkHBox" id="hbox_force_3_from">
+                                      <widget class="GtkHBox" id="hbox_force_3_from_to">
                                         <property name="visible">True</property>
                                         <property name="can_focus">False</property>
                                         <property name="spacing">6</property>
@@ -3638,39 +3590,15 @@ Fitted</property>
                                           </packing>
                                         </child>
                                         <child>
-                                          <widget class="GtkLabel" id="label95">
-                                            <property name="visible">True</property>
-                                            <property name="can_focus">False</property>
-                                            <property name="label">ms</property>
-                                          </widget>
-                                          <packing>
-                                            <property name="expand">True</property>
-                                            <property name="fill">True</property>
-                                            <property name="position">2</property>
-                                          </packing>
-                                        </child>
-                                      </widget>
-                                      <packing>
-                                        <property name="expand">False</property>
-                                        <property name="fill">False</property>
-                                        <property name="position">4</property>
-                                      </packing>
-                                    </child>
-                                    <child>
-                                      <widget class="GtkHBox" id="hbox_force_3_to">
-                                        <property name="visible">True</property>
-                                        <property name="can_focus">False</property>
-                                        <property name="spacing">6</property>
-                                        <child>
                                           <widget class="GtkLabel" id="label_force_3_to">
                                             <property name="visible">True</property>
                                             <property name="can_focus">False</property>
-                                            <property name="label">To</property>
+                                            <property name="label">to</property>
                                           </widget>
                                           <packing>
                                             <property name="expand">False</property>
                                             <property name="fill">False</property>
-                                            <property name="position">0</property>
+                                            <property name="position">2</property>
                                           </packing>
                                         </child>
                                         <child>
@@ -3691,11 +3619,11 @@ Fitted</property>
                                           <packing>
                                             <property name="expand">False</property>
                                             <property name="fill">False</property>
-                                            <property name="position">1</property>
+                                            <property name="position">3</property>
                                           </packing>
                                         </child>
                                         <child>
-                                          <widget class="GtkLabel" id="label96">
+                                          <widget class="GtkLabel" id="label95">
                                             <property name="visible">True</property>
                                             <property name="can_focus">False</property>
                                             <property name="label">ms</property>
@@ -3703,14 +3631,14 @@ Fitted</property>
                                           <packing>
                                             <property name="expand">True</property>
                                             <property name="fill">True</property>
-                                            <property name="position">2</property>
+                                            <property name="position">4</property>
                                           </packing>
                                         </child>
                                       </widget>
                                       <packing>
                                         <property name="expand">False</property>
                                         <property name="fill">False</property>
-                                        <property name="position">5</property>
+                                        <property name="position">4</property>
                                       </packing>
                                     </child>
                                   </widget>
@@ -3925,7 +3853,7 @@ Fitted</property>
                                       </packing>
                                     </child>
                                     <child>
-                                      <widget class="GtkHBox" id="hbox_force_4_from">
+                                      <widget class="GtkHBox" id="hbox_force_4_from_to">
                                         <property name="visible">True</property>
                                         <property name="can_focus">False</property>
                                         <property name="spacing">6</property>
@@ -3963,39 +3891,15 @@ Fitted</property>
                                           </packing>
                                         </child>
                                         <child>
-                                          <widget class="GtkLabel" id="label99">
-                                            <property name="visible">True</property>
-                                            <property name="can_focus">False</property>
-                                            <property name="label">ms</property>
-                                          </widget>
-                                          <packing>
-                                            <property name="expand">True</property>
-                                            <property name="fill">True</property>
-                                            <property name="position">2</property>
-                                          </packing>
-                                        </child>
-                                      </widget>
-                                      <packing>
-                                        <property name="expand">False</property>
-                                        <property name="fill">False</property>
-                                        <property name="position">4</property>
-                                      </packing>
-                                    </child>
-                                    <child>
-                                      <widget class="GtkHBox" id="hbox_force_4_to">
-                                        <property name="visible">True</property>
-                                        <property name="can_focus">False</property>
-                                        <property name="spacing">6</property>
-                                        <child>
                                           <widget class="GtkLabel" id="label_force_4_to">
                                             <property name="visible">True</property>
                                             <property name="can_focus">False</property>
-                                            <property name="label">To</property>
+                                            <property name="label">to</property>
                                           </widget>
                                           <packing>
                                             <property name="expand">False</property>
                                             <property name="fill">False</property>
-                                            <property name="position">0</property>
+                                            <property name="position">2</property>
                                           </packing>
                                         </child>
                                         <child>
@@ -4016,11 +3920,11 @@ Fitted</property>
                                           <packing>
                                             <property name="expand">False</property>
                                             <property name="fill">False</property>
-                                            <property name="position">1</property>
+                                            <property name="position">3</property>
                                           </packing>
                                         </child>
                                         <child>
-                                          <widget class="GtkLabel" id="label100">
+                                          <widget class="GtkLabel" id="label99">
                                             <property name="visible">True</property>
                                             <property name="can_focus">False</property>
                                             <property name="label">ms</property>
@@ -4028,14 +3932,14 @@ Fitted</property>
                                           <packing>
                                             <property name="expand">True</property>
                                             <property name="fill">True</property>
-                                            <property name="position">2</property>
+                                            <property name="position">4</property>
                                           </packing>
                                         </child>
                                       </widget>
                                       <packing>
                                         <property name="expand">False</property>
                                         <property name="fill">False</property>
-                                        <property name="position">5</property>
+                                        <property name="position">4</property>
                                       </packing>
                                     </child>
                                   </widget>
@@ -4052,6 +3956,32 @@ Fitted</property>
                                 <property name="position">3</property>
                               </packing>
                             </child>
+                            <child>
+                              <widget class="GtkHButtonBox" id="hbuttonbox2">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="layout_style">end</property>
+                                <child>
+                                  <widget class="GtkButton" id="button_force_rfd_default">
+                                    <property name="label">Back to default values</property>
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">True</property>
+                                    <property name="can_default">True</property>
+                                    <property name="receives_default">False</property>
+                                  </widget>
+                                  <packing>
+                                    <property name="expand">False</property>
+                                    <property name="fill">False</property>
+                                    <property name="position">0</property>
+                                  </packing>
+                                </child>
+                              </widget>
+                              <packing>
+                                <property name="expand">True</property>
+                                <property name="fill">True</property>
+                                <property name="position">4</property>
+                              </packing>
+                            </child>
                           </widget>
                         </child>
                       </widget>
diff --git a/src/gui/preferences.cs b/src/gui/preferences.cs
index 6a00c3c..d2f3963 100644
--- a/src/gui/preferences.cs
+++ b/src/gui/preferences.cs
@@ -147,14 +147,10 @@ public class PreferencesWindow
        [Widget] Gtk.HBox hbox_force_2_at_percent;
        [Widget] Gtk.HBox hbox_force_3_at_percent;
        [Widget] Gtk.HBox hbox_force_4_at_percent;
-       [Widget] Gtk.HBox hbox_force_1_from;
-       [Widget] Gtk.HBox hbox_force_2_from;
-       [Widget] Gtk.HBox hbox_force_3_from;
-       [Widget] Gtk.HBox hbox_force_4_from;
-       [Widget] Gtk.HBox hbox_force_1_to;
-       [Widget] Gtk.HBox hbox_force_2_to;
-       [Widget] Gtk.HBox hbox_force_3_to;
-       [Widget] Gtk.HBox hbox_force_4_to;
+       [Widget] Gtk.HBox hbox_force_1_from_to;
+       [Widget] Gtk.HBox hbox_force_2_from_to;
+       [Widget] Gtk.HBox hbox_force_3_from_to;
+       [Widget] Gtk.HBox hbox_force_4_from_to;
 
        //multimedia tab
        [Widget] Gtk.CheckButton checkbutton_volume;
@@ -499,7 +495,6 @@ public class PreferencesWindow
                createForceCombos();
 
                check_force_visibilities();
-
        }
 
        private void check_force_visibilities()
@@ -551,38 +546,33 @@ public class PreferencesWindow
                                        UtilGtk.ComboGetActive(combo_force_1_type),
                                        hbox_force_1_at_ms,
                                        hbox_force_1_at_percent,
-                                       hbox_force_1_from,
-                                       hbox_force_1_to);
+                                       hbox_force_1_from_to);
                else if(combo == combo_force_2_type)
                        combo_force_visibility(
                                        UtilGtk.ComboGetActive(combo_force_2_type),
                                        hbox_force_2_at_ms,
                                        hbox_force_2_at_percent,
-                                       hbox_force_2_from,
-                                       hbox_force_2_to);
+                                       hbox_force_2_from_to);
                else if(combo == combo_force_3_type)
                        combo_force_visibility(
                                        UtilGtk.ComboGetActive(combo_force_3_type),
                                        hbox_force_3_at_ms,
                                        hbox_force_3_at_percent,
-                                       hbox_force_3_from,
-                                       hbox_force_3_to);
+                                       hbox_force_3_from_to);
                else if(combo == combo_force_4_type)
                        combo_force_visibility(
                                        UtilGtk.ComboGetActive(combo_force_4_type),
                                        hbox_force_4_at_ms,
                                        hbox_force_4_at_percent,
-                                       hbox_force_4_from,
-                                       hbox_force_4_to);
+                                       hbox_force_4_from_to);
        }
 
-       private void combo_force_visibility (string selected, Gtk.HBox at_ms, Gtk.HBox at_percent, Gtk.HBox 
from, Gtk.HBox to)
+       private void combo_force_visibility (string selected, Gtk.HBox at_ms, Gtk.HBox at_percent, Gtk.HBox 
from_to)
        {
                //valid for active == "" and active == "RFD max"
                at_ms.Visible = false;
                at_percent.Visible = false;
-               from.Visible = false;
-               to.Visible = false;
+               from_to.Visible = false;
 
                //LogB.Information("Selected:" + selected + ";");
 
@@ -592,8 +582,7 @@ public class PreferencesWindow
                }
                else if(selected == Catalog.GetString("Average"))
                {
-                       from.Visible = true;
-                       to.Visible = true;
+                       from_to.Visible = true;
                }
                else if(selected == Catalog.GetString("% Force max"))
                {


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