chronojump r465 - in trunk: . build/data glade src src/gui



Author: xaviblas
Date: Mon Mar  2 12:09:58 2009
New Revision: 465
URL: http://svn.gnome.org/viewvc/chronojump?rev=465&view=rev

Log:
0.8.2.3
Added a cancel to splash window to allow cancel ping on start (good for net problems where packets are lost)


Modified:
   trunk/build/data/chronojump.prg
   trunk/build/data/chronojump_mini.prg
   trunk/build/data/version.txt
   trunk/changelog.txt
   trunk/glade/chronojump.glade
   trunk/src/chronojump.cs
   trunk/src/gui/splash.cs
   trunk/version.txt

Modified: trunk/build/data/chronojump.prg
==============================================================================
Binary files. No diff available.

Modified: trunk/build/data/chronojump_mini.prg
==============================================================================
Binary files. No diff available.

Modified: trunk/build/data/version.txt
==============================================================================
--- trunk/build/data/version.txt	(original)
+++ trunk/build/data/version.txt	Mon Mar  2 12:09:58 2009
@@ -1 +1 @@
-0.8.2.2
+0.8.2.3

Modified: trunk/changelog.txt
==============================================================================
--- trunk/changelog.txt	(original)
+++ trunk/changelog.txt	Mon Mar  2 12:09:58 2009
@@ -14,12 +14,14 @@
 
 do the ping gets real IP
 
-if a ping to server gets more than 5s, then abort, specially on start. Can be
-a network problem
-
 upload SEvaluator and edit it and re-upload
 add chronopic and device code th SEvaluator and update the diagram
 
+2 mar 2009
+	0.8.2.3
+	Added a cancel to splash window to allow cancel ping on start (good
+	for net problems where packets are lost)
+
 27 feb 2009
 	0.8.2.2
 	Fixed but untested crash at 1st and 2nd execution on some systems:

Modified: trunk/glade/chronojump.glade
==============================================================================
--- trunk/glade/chronojump.glade	(original)
+++ trunk/glade/chronojump.glade	Mon Mar  2 12:09:58 2009
@@ -24404,28 +24404,59 @@
       </child>
 
       <child>
-	<widget class="GtkLabel" id="myLabel">
+	<widget class="GtkHBox" id="hbox306">
 	  <property name="visible">True</property>
-	  <property name="sensitive">False</property>
-	  <property name="label" translatable="yes">Loading Chronojump...</property>
-	  <property name="use_underline">False</property>
-	  <property name="use_markup">False</property>
-	  <property name="justify">GTK_JUSTIFY_LEFT</property>
-	  <property name="wrap">False</property>
-	  <property name="selectable">False</property>
-	  <property name="xalign">0.5</property>
-	  <property name="yalign">0.5</property>
-	  <property name="xpad">0</property>
-	  <property name="ypad">0</property>
-	  <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
-	  <property name="width_chars">-1</property>
-	  <property name="single_line_mode">False</property>
-	  <property name="angle">0</property>
+	  <property name="homogeneous">False</property>
+	  <property name="spacing">8</property>
+
+	  <child>
+	    <widget class="GtkLabel" id="myLabel">
+	      <property name="visible">True</property>
+	      <property name="sensitive">False</property>
+	      <property name="label" translatable="yes">Loading Chronojump...</property>
+	      <property name="use_underline">False</property>
+	      <property name="use_markup">False</property>
+	      <property name="justify">GTK_JUSTIFY_LEFT</property>
+	      <property name="wrap">False</property>
+	      <property name="selectable">False</property>
+	      <property name="xalign">0.5</property>
+	      <property name="yalign">0.5</property>
+	      <property name="xpad">0</property>
+	      <property name="ypad">0</property>
+	      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+	      <property name="width_chars">-1</property>
+	      <property name="single_line_mode">False</property>
+	      <property name="angle">0</property>
+	    </widget>
+	    <packing>
+	      <property name="padding">0</property>
+	      <property name="expand">True</property>
+	      <property name="fill">True</property>
+	    </packing>
+	  </child>
+
+	  <child>
+	    <widget class="GtkButton" id="button_cancel">
+	      <property name="visible">True</property>
+	      <property name="tooltip" translatable="yes">Cancel connection with server</property>
+	      <property name="can_focus">True</property>
+	      <property name="label">gtk-cancel</property>
+	      <property name="use_stock">True</property>
+	      <property name="relief">GTK_RELIEF_NORMAL</property>
+	      <property name="focus_on_click">True</property>
+	      <signal name="clicked" handler="on_button_cancel_clicked" last_modification_time="Fri, 27 Feb 2009 21:21:50 GMT"/>
+	    </widget>
+	    <packing>
+	      <property name="padding">0</property>
+	      <property name="expand">False</property>
+	      <property name="fill">False</property>
+	    </packing>
+	  </child>
 	</widget>
 	<packing>
 	  <property name="padding">0</property>
-	  <property name="expand">False</property>
-	  <property name="fill">False</property>
+	  <property name="expand">True</property>
+	  <property name="fill">True</property>
 	</packing>
       </child>
 

Modified: trunk/src/chronojump.cs
==============================================================================
--- trunk/src/chronojump.cs	(original)
+++ trunk/src/chronojump.cs	Mon Mar  2 12:09:58 2009
@@ -29,7 +29,6 @@
 
 using System.Collections; //ArrayList
 
-
 public class ChronoJump 
 {
 	ChronoJumpWindow chronoJumpWin;
@@ -105,6 +104,10 @@
 		Application.Run();
 	}
 
+	string versionAvailable;
+	bool pinging;
+	bool pulseGTKPingShouldEnd;
+
 	protected void sqliteThings () {
 		bool crashedBefore = checkIfChronojumpExitAbnormally();
 		
@@ -242,7 +245,16 @@
 		messageToShowOnBoot += recuperateBrokenEvents();
 
 		//connect to server to Ping
-		string versionAvailable = Server.Ping(true, progName, readVersion()); //doInsertion
+		versionAvailable = "";
+		pinging = false;
+			
+		thread = new Thread(new ThreadStart(findVersion));
+		GLib.Idle.Add (new GLib.IdleHandler (PulseGTKPing));
+		thread.Start(); 
+
+		while(pinging) {
+		}
+
 		string versionAvailableKnown = SqlitePreferences.Select("versionAvailable");
 		if( versionAvailable != Constants.ServerOffline && versionAvailable != progVersion ) {
 			//versionAvailable is higher than client version
@@ -282,6 +294,31 @@
 
 	}
 
+	private void findVersion() {
+		pinging = true;
+	Console.Write(" 1 ");
+		pulseGTKPingShouldEnd = false;
+	Console.Write(" 2 ");
+		splashShowButton = true;
+	Console.Write(" 3 ");
+		splashWin.FakeButtonCancel.Clicked += new EventHandler(on_find_version_cancelled);
+	Console.Write(" 4 ");
+		versionAvailable = Server.Ping(true, progName, readVersion()); //doInsertion
+	Console.Write(" 5 ");
+		splashShowButton = false;
+	Console.Write(" 6 ");
+	Console.Write(" version:  " + versionAvailable);
+
+	pinging = false;
+	}
+		
+	private void on_find_version_cancelled(object o, EventArgs args) {
+		splashShowButton = false;
+		pulseGTKPingShouldEnd = true;
+		versionAvailable = Constants.ServerOffline;
+		pinging = false;
+	}
+
 	protected void readMessageToStart() {
 		if(messageToShowOnBoot.Length > 0) {
 			ErrorWindow errorWin;
@@ -289,15 +326,12 @@
 				messageToShowOnBoot += "\n<b>" + string.Format(Catalog.GetString("Chronojump will exit now.")) + "</b>\n";
 				errorWin = ErrorWindow.Show(messageToShowOnBoot);
 				errorWin.Button_accept.Clicked += new EventHandler(on_message_boot_accepted_quit);
-//				Application.Run();
 			} else { 
 				errorWin = ErrorWindow.Show(messageToShowOnBoot);
 				errorWin.Button_accept.Clicked += new EventHandler(on_message_boot_accepted_continue);
-//				Application.Run();
 			}
 		} else {
 			startChronojump();
-//			Application.Run();
 		}
 	}
 
@@ -347,6 +381,8 @@
 	/* splash window things 
 	 * --------------------*/
 
+	private bool splashShowButton = false;
+
 	private void splashMessageChange(int messageInt) {
 	       splashMessage = Catalog.GetString(Constants.SplashMessages[messageInt]);
 		needUpdateSplashMessage = true;
@@ -354,7 +390,8 @@
 	
 	protected bool PulseGTK ()
 	{
-		if(needEndSplashWin || ! thread.IsAlive) {
+		if( ( needEndSplashWin && ! pinging) 
+				|| ! thread.IsAlive) {
 			fakeSplashButton.Click();
 			Log.Write("splash window dying here");
 			return false;
@@ -362,7 +399,7 @@
 		//need to do this, if not it crashes because chronopicWin gets died by thread ending
 		splashWin = SplashWindow.Show();
 		//Log.WriteLine("splash");
-
+	
 		if(updatingDB) {
 			splashWin.ShowProgressbar("updating");
 			splashWin.UpdateLabel(splashMessage + " " + Sqlite.PrintConversionText());
@@ -398,6 +435,23 @@
 		readMessageToStart();
 	}
 
+	protected bool PulseGTKPing ()
+	{
+		if(pulseGTKPingShouldEnd) {
+			splashWin.CancelButtonShow(false);
+			return false;
+		}
+
+		if(splashShowButton)
+			splashWin.CancelButtonShow(true); //show cancel button on splash win
+		else
+			splashWin.CancelButtonShow(false);
+
+
+		Thread.Sleep (50);
+		return true;
+	}
+	
 		
 	/* ---------------------
 	 * other support methods 

Modified: trunk/src/gui/splash.cs
==============================================================================
--- trunk/src/gui/splash.cs	(original)
+++ trunk/src/gui/splash.cs	Mon Mar  2 12:09:58 2009
@@ -31,7 +31,11 @@
 	[Widget] Gtk.ProgressBar progressbarRate;
 	[Widget] Gtk.ProgressBar progressbarSubRate;
 	[Widget] Gtk.Label myLabel;
+	[Widget] Gtk.Button button_cancel;
 
+	
+	public Gtk.Button fakeButtonCancel;
+	
 	static SplashWindow SplashWindowBox;
 
 	public SplashWindow ()
@@ -43,6 +47,8 @@
 		//put an icon to window
 		UtilGtk.IconWindow(splash_window);
 
+		fakeButtonCancel = new Gtk.Button();
+		CancelButtonShow(false);
 		hideAllProgressbars();
 
 		//put logo image
@@ -92,11 +98,34 @@
 		else 
 			progressbarSubRate.Fraction = fraction;
 	}
-		
-			
+	
 	public void UpdateLabel (string text) {
 		myLabel.Text = text;
 	}
+	
+	/* 
+	 * cancel	
+	 * for SPing
+	 */
+	public void CancelButtonShow(bool show) {
+		if(show)
+			button_cancel.Show();
+		else
+			button_cancel.Hide();
+	}
+	
+	protected void on_button_cancel_clicked (object o, EventArgs args)
+	{
+		fakeButtonCancel.Click();
+	}
+	
+	public Button FakeButtonCancel 
+	{
+		set { fakeButtonCancel = value; }
+		get { return fakeButtonCancel; }
+	}
+
+			
 
 	public void Destroy () {
 		SplashWindowBox.splash_window.Destroy ();

Modified: trunk/version.txt
==============================================================================
--- trunk/version.txt	(original)
+++ trunk/version.txt	Mon Mar  2 12:09:58 2009
@@ -1 +1 @@
-0.8.2.2
+0.8.2.3



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