[f-spot: 4/5] DateRangeDialog moved to Gtk.Builder



commit a91ebc8c51833f4cdfe8458b391128a83ebb7bd5
Author: Stephane Delcroix <stephane delcroix org>
Date:   Mon May 18 15:56:54 2009 +0200

    DateRangeDialog moved to Gtk.Builder
    
    the DateRangeDialog is now build with Gtk.Builder (and no longer with glade). the dialog is now a Gtk.Dialog.
---
 src/MainWindow.cs                |    7 ++---
 src/UI.Dialog/DateRangeDialog.cs |   39 +++++++++++--------------------------
 2 files changed, 15 insertions(+), 31 deletions(-)

diff --git a/src/MainWindow.cs b/src/MainWindow.cs
index 56993f7..cbd13da 100644
--- a/src/MainWindow.cs
+++ b/src/MainWindow.cs
@@ -2649,12 +2649,11 @@ public class MainWindow {
 	}
 
 	void HandleSetDateRange (object sender, EventArgs args) {
-		var date_range_dialog = new DateRangeDialog (query, main_window);
+		var date_range_dialog = new DateRangeDialog (query.Range, main_window);
 		if ((ResponseType)date_range_dialog.Run () == ResponseType.Ok)
-			Console.WriteLine ("DO SOMETHING");
+			query.Range = date_range_dialog.Range;
 		date_range_dialog.Destroy ();
-//		DateCommands.Set set_command = new DateCommands.Set (query, main_window);
-//		set_command.Execute ();
+
 		//update the TimeLine
 		if (group_selector.Adaptor is TimeAdaptor && query.Range != null) 
 			group_selector.SetLimitsToDates(query.Range.Start, query.Range.End);
diff --git a/src/UI.Dialog/DateRangeDialog.cs b/src/UI.Dialog/DateRangeDialog.cs
index 0b80887..3a69e17 100644
--- a/src/UI.Dialog/DateRangeDialog.cs
+++ b/src/UI.Dialog/DateRangeDialog.cs
@@ -46,7 +46,7 @@ namespace FSpot.UI.Dialog
 			"customizedrange"
 		};
 
-		public DateRangeDialog (FSpot.PhotoQuery query, Gtk.Window parent_window) : base ("DateRangeDialog.ui", "date_range_dialog")
+		public DateRangeDialog (DateRange query_range, Gtk.Window parent_window) : base ("DateRangeDialog.ui", "date_range_dialog")
 		{
 			this.query = query;
 			this.parent_window = parent_window;
@@ -63,30 +63,14 @@ namespace FSpot.UI.Dialog
 			foreach (string range in ranges)
 				rangestore.AppendValues (GetString(range));
 
-//			start_dateedit.DateChanged += HandleDateEditChanged;
-//			((Gtk.Entry) start_dateedit.Children [0] as Gtk.Entry).Changed += HandleDateEditChanged;
-//			end_dateedit.DateChanged += HandleDateEditChanged;
-//			((Gtk.Entry) end_dateedit.Children [0] as Gtk.Entry).Changed += HandleDateEditChanged;
-//			
-           	 	period_combobox.Active = System.Array.IndexOf(ranges, "last7days"); // Default to Last 7 days
 			period_combobox.Changed += HandlePeriodComboboxChanged;
-//
-//			if (query.Range != null) {
-//				start_dateedit.Time = query.Range.Start;
-//				end_dateedit.Time = query.Range.End;
-//			}
-//
-//			ResponseType response = (ResponseType) this.Dialog.Run ();
-//
-//			bool success = false;
-//
-//			if (response == ResponseType.Ok) {
-//				query.Range = QueryRange (period_combobox.Active);
-//				success = true;
-//			}
-//			
-//			this.Dialog.Destroy ();
-//			return success;
+           	 	period_combobox.Active = System.Array.IndexOf(ranges, "last7days"); // Default to Last 7 days
+
+			if (query_range != null) {
+				start_dateedit.Time = query_range.Start;
+				end_dateedit.Time = query_range.End;
+			}
+
 		}
 
 		void RangeCellFunc (CellLayout cell_layout, CellRenderer cell, TreeModel tree_model, TreeIter iter)
@@ -146,11 +130,12 @@ namespace FSpot.UI.Dialog
 			}	
 		}
 
+		public DateRange Range {
+			get { return QueryRange (period_combobox.Active); }
+		}
+
 		private DateRange QueryRange (int index)
 		{
-			Console.WriteLine ("QueryRange");
-			Console.WriteLine ("index " + index);
-			Console.WriteLine ("ranges " + ranges);
 			return QueryRange ( ranges [index]);
 		}
 



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