[f-spot/FSPOT_0_6_0_STABLE] Parse new date time and offset on every change



commit e491349b15242bc7e4ec9410d150a899bb4065ce
Author: Stephane Delcroix <stephane delcroix org>
Date:   Tue Aug 25 16:58:43 2009 +0200

    Parse new date time and offset on every change
    
    no longer try to parse only on Activated event, but on every Changed one. Fixes bgo#590581

 src/Widgets/DateEdit.cs |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)
---
diff --git a/src/Widgets/DateEdit.cs b/src/Widgets/DateEdit.cs
index e46ca3c..132f7a1 100644
--- a/src/Widgets/DateEdit.cs
+++ b/src/Widgets/DateEdit.cs
@@ -108,7 +108,7 @@ namespace FSpot.Widgets
 			Spacing = 1;
 
 			Add (date_entry = new Entry () {WidthChars = 10, IsEditable = true});
-			date_entry.Activated += HandleDateEntryActivated;
+			date_entry.Changed += HandleDateEntryChanged;
 			date_entry.Show ();
 			var bbox = new HBox ();
 			Widget w;
@@ -121,10 +121,10 @@ namespace FSpot.Widgets
 			date_button.Clicked += HandleCalendarButtonClicked;
 			date_button.Show ();
 			Add (time_entry = new Entry () {WidthChars = 12, IsEditable = true});
-			time_entry.Activated += HandleTimeEntryActivated;
+			time_entry.Changed += HandleTimeEntryChanged;
 			time_entry.Show ();
 			Add (offset_entry = new Entry () {WidthChars = 6, IsEditable = true});
-			offset_entry.Activated += HandleOffsetEntryActivated;
+			offset_entry.Changed += HandleOffsetEntryChanged;
 			offset_entry.Show ();
 
 			calendar = new Calendar ();
@@ -209,16 +209,16 @@ namespace FSpot.Widgets
 			GrabPointerAndKeyboard (calendar_popup.GdkWindow, Gtk.Global.CurrentEventTime);
 		}
 
-		void HandleDateEntryActivated (object sender, EventArgs e)
+		void HandleDateEntryChanged (object sender, EventArgs e)
 		{
 			DateTimeOffset new_date;
 			if (DateTimeOffset.TryParseExact (date_entry.Text, "d", null, System.Globalization.DateTimeStyles.AssumeLocal | System.Globalization.DateTimeStyles.AllowWhiteSpaces, out new_date))
-				DateTimeOffset = new DateTimeOffset (calendar.Date + DateTimeOffset.TimeOfDay, DateTimeOffset.Offset);
+				DateTimeOffset = new DateTimeOffset (new_date.Date + DateTimeOffset.TimeOfDay, DateTimeOffset.Offset);
 			else 
 				date_entry.ModifyBase (StateType.Normal, red);
 		}
 
-		void HandleTimeEntryActivated (object sender, EventArgs e)
+		void HandleTimeEntryChanged (object sender, EventArgs e)
 		{
 			DateTimeOffset new_date;
 			if (DateTimeOffset.TryParseExact (String.Format ("{0} {1}", DateTimeOffset.ToString ("d"), time_entry.Text), ShowSeconds ? "G" : "g", null, System.Globalization.DateTimeStyles.AssumeLocal | System.Globalization.DateTimeStyles.AllowWhiteSpaces, out new_date)) {
@@ -228,7 +228,7 @@ namespace FSpot.Widgets
 
 		}
 
-		void HandleOffsetEntryActivated (object sender, EventArgs e)
+		void HandleOffsetEntryChanged (object sender, EventArgs e)
 		{
 			TimeSpan new_offset;
 			if (TimeSpan.TryParse (offset_entry.Text.Trim ('+'), out new_offset))



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