[chronojump] personWin error messages without error window (no open new popup)



commit 1967af2662db22b2e3ee5cf1bdcbebaee8bebea5
Author: Xavier de Blas <xaviblas gmail com>
Date:   Fri Feb 9 12:23:58 2018 +0100

    personWin error messages without error window (no open new popup)

 glade/person_win.glade |   63 +++++++++++++++++++++++++++++++++++++++++++----
 src/gui/person.cs      |   30 +++++++++++++++++++---
 src/gui/runType.cs     |    2 +-
 3 files changed, 84 insertions(+), 11 deletions(-)
---
diff --git a/glade/person_win.glade b/glade/person_win.glade
index d82fe5f..e3afecf 100644
--- a/glade/person_win.glade
+++ b/glade/person_win.glade
@@ -14,12 +14,12 @@
     <property name="type_hint">dialog</property>
     <signal name="delete_event" handler="on_person_win_delete_event" swapped="no"/>
     <child>
-      <widget class="GtkVBox" id="vbox4">
+      <widget class="GtkVBox" id="vbox_main">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
         <property name="spacing">8</property>
         <child>
-          <widget class="GtkNotebook" id="notebook1">
+          <widget class="GtkNotebook" id="notebook_main">
             <property name="visible">True</property>
             <property name="can_focus">True</property>
             <property name="tab_hborder">10</property>
@@ -566,9 +566,6 @@
                                       <placeholder/>
                                     </child>
                                     <child>
-                                      <placeholder/>
-                                    </child>
-                                    <child>
                                       <widget class="GtkLabel" id="label218">
                                         <property name="visible">True</property>
                                         <property name="can_focus">False</property>
@@ -1970,6 +1967,9 @@
                                     <child>
                                       <placeholder/>
                                     </child>
+                                    <child>
+                                      <placeholder/>
+                                    </child>
                                   </widget>
                                 </child>
                               </widget>
@@ -2021,7 +2021,7 @@
           </packing>
         </child>
         <child>
-          <widget class="GtkHButtonBox" id="hbuttonbox2">
+          <widget class="GtkHButtonBox" id="hbuttonbox_main">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
             <property name="border_width">8</property>
@@ -2067,6 +2067,57 @@
             <property name="position">1</property>
           </packing>
         </child>
+        <child>
+          <widget class="GtkVBox" id="vbox_error">
+            <property name="can_focus">False</property>
+            <property name="spacing">20</property>
+            <child>
+              <widget class="GtkLabel" id="label_error">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="wrap">True</property>
+              </widget>
+              <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkHButtonBox" id="hbuttonbox1">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <child>
+                  <widget class="GtkButton" id="button_error_go_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="has_default">True</property>
+                    <property name="receives_default">False</property>
+                    <property name="use_stock">True</property>
+                    <signal name="clicked" handler="on_button_error_go_back_clicked" swapped="no"/>
+                  </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">1</property>
+              </packing>
+            </child>
+          </widget>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+            <property name="position">2</property>
+          </packing>
+        </child>
       </widget>
     </child>
   </widget>
diff --git a/src/gui/person.cs b/src/gui/person.cs
index 8f889ea..0e55b30 100644
--- a/src/gui/person.cs
+++ b/src/gui/person.cs
@@ -787,7 +787,12 @@ public class PersonAddModifyWindow
        [Widget] Gtk.RadioButton radiobutton_woman;
        [Widget] Gtk.TextView textview_description;
        [Widget] Gtk.TextView textview_ps_comments;
-       
+
+       [Widget] Gtk.Notebook notebook_main;
+       [Widget] Gtk.HButtonBox hbuttonbox_main;
+       [Widget] Gtk.VBox vbox_error;
+       [Widget] Gtk.Label label_error;
+
        [Widget] Gtk.Button button_add_photo_file;
        [Widget] Gtk.Button button_take_photo;
        
@@ -1645,8 +1650,10 @@ public class PersonAddModifyWindow
                        errorMessage += "\n" + Catalog.GetString("Please, write the name of the person.");
                if((double) spinbutton_weight.Value == 0)
                        errorMessage += "\n" + Catalog.GetString("Please, complete the weight of the 
person.");
-               if(errorMessage.Length > 0) {
-                       ErrorWindow.Show(errorMessage);
+               if(errorMessage.Length > 0)
+               {
+                       label_error.Text = errorMessage;
+                       showErrorMessage(true);
                        return;
                }
 
@@ -1683,7 +1690,22 @@ public class PersonAddModifyWindow
                }
 
                if(errorMessage.Length > 0)
-                       ErrorWindow.Show(errorMessage);
+               {
+                       label_error.Text = errorMessage;
+                       showErrorMessage(true);
+               }
+       }
+
+       void on_button_error_go_back_clicked (object o, EventArgs args)
+       {
+               showErrorMessage(false);
+       }
+
+       void showErrorMessage(bool show)
+       {
+               vbox_error.Visible = show;
+               notebook_main.Visible = ! show;
+               hbuttonbox_main.Visible = ! show;
        }
 
        void on_convertWeightWin_accepted (object o, EventArgs args) {
diff --git a/src/gui/runType.cs b/src/gui/runType.cs
index 23073e7..409bc4a 100644
--- a/src/gui/runType.cs
+++ b/src/gui/runType.cs
@@ -126,7 +126,7 @@ public class RunTypeAddWindow
                button_accept.Sensitive = false;
                spin_fixed_tracks_or_time.Sensitive = false;
                label_distance.Text = Catalog.GetString("Distance");
-               System.Globalization.NumberFormatInfo localeInfo = new 
System.Globalization.NumberFormatInfo();
+               //System.Globalization.NumberFormatInfo localeInfo = new 
System.Globalization.NumberFormatInfo();
                
                radiobutton_dist_different.Visible = ! simple;
                hbox_distance_fixed.Hide();     


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