[chronojump] Add run type different for simple & intervallic



commit 9607f46f6647e5519918352f91530822a4877a8a
Author: Xavier de Blas <xaviblas gmail com>
Date:   Sun Apr 3 22:34:02 2011 +0200

    Add run type different for simple & intervallic

 glade/chronojump.glade |   12 +++++++-----
 po/ca.po               |    2 +-
 src/gui/chronojump.cs  |   13 ++++++++++---
 src/gui/runType.cs     |   33 +++++++++++++++++++++++++--------
 4 files changed, 43 insertions(+), 17 deletions(-)
---
diff --git a/glade/chronojump.glade b/glade/chronojump.glade
index f825460..f9e1681 100644
--- a/glade/chronojump.glade
+++ b/glade/chronojump.glade
@@ -3580,7 +3580,7 @@ options</property>
               </packing>
             </child>
             <child>
-              <widget class="GtkLabel" id="label137">
+              <widget class="GtkLabel" id="label_main_options">
                 <property name="visible">True</property>
                 <property name="xalign">0</property>
                 <property name="label" translatable="yes">Main
@@ -3594,7 +3594,7 @@ options</property>
               </packing>
             </child>
             <child>
-              <widget class="GtkTable" id="table18">
+              <widget class="GtkTable" id="table_main_options">
                 <property name="visible">True</property>
                 <property name="border_width">8</property>
                 <property name="n_rows">3</property>
@@ -3603,7 +3603,6 @@ options</property>
                 <property name="row_spacing">4</property>
                 <child>
                   <widget class="GtkLabel" id="label138">
-                    <property name="visible">True</property>
                     <property name="label" translatable="yes">Type</property>
                   </widget>
                   <packing>
@@ -14216,6 +14215,7 @@ Chronopic</property>
                                 <child>
                                   <widget class="GtkNotebook" id="notebook_execute">
                                     <property name="visible">True</property>
+                                    <property name="show_tabs">False</property>
                                     <property name="show_border">False</property>
                                     <child>
                                       <widget class="GtkFrame" id="frame2">
@@ -15239,6 +15239,7 @@ Chronopic</property>
                                                     <child>
                                                       <widget class="GtkHBox" id="hbox33">
                                                         <property name="visible">True</property>
+                                                        <property name="spacing">4</property>
                                                         <child>
                                                           <widget class="GtkRadioButton" id="extra_window_radio_run_more">
                                                             <property name="visible">True</property>
@@ -15286,7 +15287,7 @@ Chronopic</property>
                                                             <property name="receives_default">True</property>
                                                             <property name="has_tooltip">True</property>
                                                             <property name="tooltip" translatable="yes">Add run type</property>
-                                                            <signal name="clicked" handler="on_run_type_add_activate"/>
+                                                            <signal name="clicked" handler="on_run_simple_type_add_activate"/>
                                                             <child>
                                                             <widget class="GtkImage" id="image3212">
                                                             <property name="visible">True</property>
@@ -15551,6 +15552,7 @@ Chronopic</property>
                                                 <child>
                                                   <widget class="GtkHBox" id="hbox41">
                                                     <property name="visible">True</property>
+                                                    <property name="spacing">4</property>
                                                     <child>
                                                       <widget class="GtkButton" id="button_time_bells">
                                                         <property name="visible">True</property>
@@ -15604,7 +15606,7 @@ Chronopic</property>
                                                         <property name="receives_default">True</property>
                                                         <property name="has_tooltip">True</property>
                                                         <property name="tooltip" translatable="yes">Add run type</property>
-                                                        <signal name="clicked" handler="on_run_type_add_activate"/>
+                                                        <signal name="clicked" handler="on_run_intervallic_type_add_activate"/>
                                                         <child>
                                                           <widget class="GtkImage" id="image3213">
                                                             <property name="visible">True</property>
diff --git a/po/ca.po b/po/ca.po
index f6eab2d..86349fe 100644
--- a/po/ca.po
+++ b/po/ca.po
@@ -3868,7 +3868,7 @@ msgstr "Afegit salt reactiu."
 #. without filter, only select name
 #: ../src/gui/chronojump.cs:4614
 msgid "Added simple run."
-msgstr "Afegida cursa reactiva."
+msgstr "Afegida cursa simple."
 
 #. without filter, only select name
 #: ../src/gui/chronojump.cs:4617
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index 15a669d..08c1550 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -4965,10 +4965,17 @@ Console.WriteLine("X");
 		combo_jumps_rj.Active = 0;
 	}
 
-	private void on_run_type_add_activate (object o, EventArgs args) {
-		Log.WriteLine("Add new run type");
+	private void on_run_simple_type_add_activate (object o, EventArgs args) {
+		Log.WriteLine("Add simple new run type");
 			
-		runTypeAddWin = RunTypeAddWindow.Show(app1);
+		runTypeAddWin = RunTypeAddWindow.Show(app1, true); //is simple
+		runTypeAddWin.FakeButtonAccept.Clicked += new EventHandler(on_run_type_add_accepted);
+	}
+	
+	private void on_run_intervallic_type_add_activate (object o, EventArgs args) {
+		Log.WriteLine("Add intervallic new run type");
+			
+		runTypeAddWin = RunTypeAddWindow.Show(app1, false); //is intervallic
 		runTypeAddWin.FakeButtonAccept.Clicked += new EventHandler(on_run_type_add_accepted);
 	}
 	
diff --git a/src/gui/runType.cs b/src/gui/runType.cs
index 824885e..7eb6462 100644
--- a/src/gui/runType.cs
+++ b/src/gui/runType.cs
@@ -37,6 +37,10 @@ public class RunTypeAddWindow
 	[Widget] Gtk.Button button_accept;
 	public Gtk.Button fakeButtonAccept;
 	[Widget] Gtk.Entry entry_name;
+	
+	[Widget] Gtk.Label label_main_options;
+	[Widget] Gtk.Table table_main_options;
+
 	[Widget] Gtk.RadioButton radiobutton_simple;
 	[Widget] Gtk.RadioButton radiobutton_interval;
 	[Widget] Gtk.RadioButton radiobutton_unlimited;
@@ -79,7 +83,7 @@ public class RunTypeAddWindow
 
 	public bool InsertedSimple;
 
-	RunTypeAddWindow (Gtk.Window parent) {
+	RunTypeAddWindow (Gtk.Window parent, bool simple) {
 		Glade.XML gladeXML;
 		gladeXML = Glade.XML.FromAssembly (Util.GetGladePath() + "chronojump.glade", "run_type_add", null);
 		gladeXML.Autoconnect(this);
@@ -91,29 +95,42 @@ public class RunTypeAddWindow
 		UtilGtk.IconWindow(run_type_add);
 	}
 	
-	static public RunTypeAddWindow Show (Gtk.Window parent)
+	static public RunTypeAddWindow Show (Gtk.Window parent, bool simple)
 	{
 		if (RunTypeAddWindowBox == null) {
-			RunTypeAddWindowBox = new RunTypeAddWindow (parent);
+			RunTypeAddWindowBox = new RunTypeAddWindow (parent, simple);
 		}
 		
 		RunTypeAddWindowBox.run_type_add.Show ();
-		RunTypeAddWindowBox.fillDialog ();
+		RunTypeAddWindowBox.fillDialog (simple);
 
 		return RunTypeAddWindowBox;
 	}
 	
-	private void fillDialog ()
+	private void fillDialog (bool simple)
 	{
-		vbox_limited.Sensitive = false;	
-		hbox_fixed.Sensitive = false;	
+		//active the desired radio
+		if(simple)
+			radiobutton_simple.Active = true;
+		else
+			radiobutton_interval.Active = true;
+
+		//don't show the radios
+		radiobutton_simple.Visible = false;
+		radiobutton_interval.Visible = false;
+
+		//if simple don't show nothing
+		label_main_options.Visible = ! simple;
+		table_main_options.Visible = ! simple;
+
+		//hbox_fixed.Sensitive = false;	
 		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();
 		label_decimal.Text = string.Format(Catalog.GetString("\n(decimal separator: '{0}')"), localeInfo.NumberDecimalSeparator);
 		
-		radiobutton_dist_different.Sensitive = false;
+		radiobutton_dist_different.Visible = ! simple;
 		hbox_distance_fixed.Hide();	
 		vbox_distance_variable.Hide();	
 					



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