[tasque/viewmodel: 18/78] WiP
- From: Antonius Riha <antoniusri src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tasque/viewmodel: 18/78] WiP
- Date: Wed, 29 Aug 2012 18:36:10 +0000 (UTC)
commit 5dee522f7b004e1b2887de3b4e8c3ccc7210f58a
Author: Antonius Riha <antoniusriha gmail com>
Date: Thu Jul 26 20:50:04 2012 +0200
WiP
src/ObservableTransformCollections | 2 +-
src/libtasqueui/{Preferences.cs => CommandBase.cs} | 60 ++++++---
src/libtasqueui/{Preferences.cs => ICommand.cs} | 28 +---
src/libtasqueui/{Preferences.cs => ITimeAware.cs} | 26 +---
.../CompletionDateRange.cs} | 33 +----
src/libtasqueui/Legacy/MainWindowModel.cs | 149 +++++++++++++++++---
src/libtasqueui/{ => Legacy}/Preferences.cs | 25 +++-
src/libtasqueui/Legacy/TaskCommands.cs | 123 ++++++++++++++++
src/libtasqueui/Legacy/TaskComparer.cs | 2 +-
src/libtasqueui/libtasqueui.csproj | 7 +-
src/tasque/CompletedTaskGroup.cs | 76 ++++++----
src/tasque/tasque.csproj | 1 -
12 files changed, 388 insertions(+), 144 deletions(-)
---
diff --git a/src/ObservableTransformCollections b/src/ObservableTransformCollections
index 2b9190c..16d19a4 160000
--- a/src/ObservableTransformCollections
+++ b/src/ObservableTransformCollections
@@ -1 +1 @@
-Subproject commit 2b9190c75ed72be059e6ba3d35a17b008417be81
+Subproject commit 16d19a457fe17eab7aa3e2b94cd4aa426e0b715e
diff --git a/src/libtasqueui/Preferences.cs b/src/libtasqueui/CommandBase.cs
similarity index 58%
copy from src/libtasqueui/Preferences.cs
copy to src/libtasqueui/CommandBase.cs
index ffc591a..a84ea5f 100644
--- a/src/libtasqueui/Preferences.cs
+++ b/src/libtasqueui/CommandBase.cs
@@ -1,5 +1,5 @@
//
-// Preferences.cs
+// CommandBase.cs
//
// Author:
// Antonius Riha <antoniusriha gmail com>
@@ -24,31 +24,55 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
-using System.ComponentModel;
namespace Tasque.UIModel
{
- public class Preferences : INotifyPropertyChanged
+ public abstract class CommandBase : ICommand
{
- public bool ShowCompletedTasks {
- get { return showCompletedTasks; }
- set {
- if (value != showCompletedTasks) {
- showCompletedTasks = value;
- OnPropertyChanged ("ShowCompletedTasks");
+ public bool CanExecute {
+ get { return canExecute; }
+ private set {
+ if (value != canExecute) {
+ canExecute = value;
+ if (CanExecuteChanged != null)
+ CanExecuteChanged (this, EventArgs.Empty);
}
}
}
-
- public event PropertyChangedEventHandler PropertyChanged;
-
- protected void OnPropertyChanged (string propertyName)
+
+ public string ErrorMessage { get; private set; }
+
+ public abstract void Execute ();
+
+ public event EventHandler CanExecuteChanged;
+
+ protected void SetCanExecute ()
{
- if (PropertyChanged != null)
- PropertyChanged (this, new PropertyChangedEventArgs (propertyName));
+ ErrorMessage = null;
+ CanExecute = true;
}
-
- bool showCompletedTasks;
+
+ protected void UnsetCanExecute (string reason)
+ {
+ if (reason == null)
+ throw new ArgumentNullException ("reason");
+
+ ErrorMessage = reason;
+ CanExecute = false;
+ }
+
+ bool canExecute;
+
+ #region Explicit
+ bool ICommand.CanExecute (object parameter)
+ {
+ return CanExecute;
+ }
+
+ void ICommand.Execute (object parameter)
+ {
+ Execute ();
+ }
+ #endregion
}
}
-
diff --git a/src/libtasqueui/Preferences.cs b/src/libtasqueui/ICommand.cs
similarity index 68%
copy from src/libtasqueui/Preferences.cs
copy to src/libtasqueui/ICommand.cs
index ffc591a..e5e1fb1 100644
--- a/src/libtasqueui/Preferences.cs
+++ b/src/libtasqueui/ICommand.cs
@@ -1,5 +1,5 @@
//
-// Preferences.cs
+// ICommand.cs
//
// Author:
// Antonius Riha <antoniusriha gmail com>
@@ -24,31 +24,13 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
-using System.ComponentModel;
namespace Tasque.UIModel
{
- public class Preferences : INotifyPropertyChanged
+ public interface ICommand
{
- public bool ShowCompletedTasks {
- get { return showCompletedTasks; }
- set {
- if (value != showCompletedTasks) {
- showCompletedTasks = value;
- OnPropertyChanged ("ShowCompletedTasks");
- }
- }
- }
-
- public event PropertyChangedEventHandler PropertyChanged;
-
- protected void OnPropertyChanged (string propertyName)
- {
- if (PropertyChanged != null)
- PropertyChanged (this, new PropertyChangedEventArgs (propertyName));
- }
-
- bool showCompletedTasks;
+ bool CanExecute (object parameter);
+ void Execute (object parameter);
+ event EventHandler CanExecuteChanged;
}
}
-
diff --git a/src/libtasqueui/Preferences.cs b/src/libtasqueui/ITimeAware.cs
similarity index 68%
copy from src/libtasqueui/Preferences.cs
copy to src/libtasqueui/ITimeAware.cs
index ffc591a..bbdb015 100644
--- a/src/libtasqueui/Preferences.cs
+++ b/src/libtasqueui/ITimeAware.cs
@@ -1,5 +1,5 @@
//
-// Preferences.cs
+// ITimeAware.cs
//
// Author:
// Antonius Riha <antoniusriha gmail com>
@@ -24,31 +24,11 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System;
-using System.ComponentModel;
namespace Tasque.UIModel
{
- public class Preferences : INotifyPropertyChanged
+ public interface ITimeAware
{
- public bool ShowCompletedTasks {
- get { return showCompletedTasks; }
- set {
- if (value != showCompletedTasks) {
- showCompletedTasks = value;
- OnPropertyChanged ("ShowCompletedTasks");
- }
- }
- }
-
- public event PropertyChangedEventHandler PropertyChanged;
-
- protected void OnPropertyChanged (string propertyName)
- {
- if (PropertyChanged != null)
- PropertyChanged (this, new PropertyChangedEventArgs (propertyName));
- }
-
- bool showCompletedTasks;
+ void OnDayChanged ();
}
}
-
diff --git a/src/libtasqueui/Preferences.cs b/src/libtasqueui/Legacy/CompletionDateRange.cs
similarity index 66%
copy from src/libtasqueui/Preferences.cs
copy to src/libtasqueui/Legacy/CompletionDateRange.cs
index ffc591a..e80be51 100644
--- a/src/libtasqueui/Preferences.cs
+++ b/src/libtasqueui/Legacy/CompletionDateRange.cs
@@ -1,5 +1,5 @@
//
-// Preferences.cs
+// CompletionDateRange.cs
//
// Author:
// Antonius Riha <antoniusriha gmail com>
@@ -23,32 +23,15 @@
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-using System;
-using System.ComponentModel;
-namespace Tasque.UIModel
+namespace Tasque.UIModel.Legacy
{
- public class Preferences : INotifyPropertyChanged
+ public enum CompletionDateRange
{
- public bool ShowCompletedTasks {
- get { return showCompletedTasks; }
- set {
- if (value != showCompletedTasks) {
- showCompletedTasks = value;
- OnPropertyChanged ("ShowCompletedTasks");
- }
- }
- }
-
- public event PropertyChangedEventHandler PropertyChanged;
-
- protected void OnPropertyChanged (string propertyName)
- {
- if (PropertyChanged != null)
- PropertyChanged (this, new PropertyChangedEventArgs (propertyName));
- }
-
- bool showCompletedTasks;
+ Yesterday,
+ Last7Days,
+ LastMonth,
+ LastYear,
+ All
}
}
-
diff --git a/src/libtasqueui/Legacy/MainWindowModel.cs b/src/libtasqueui/Legacy/MainWindowModel.cs
index ce6b225..085c5c5 100644
--- a/src/libtasqueui/Legacy/MainWindowModel.cs
+++ b/src/libtasqueui/Legacy/MainWindowModel.cs
@@ -23,45 +23,158 @@
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-using System.ComponentModel;
+using System;
using CollectionTransforms;
namespace Tasque.UIModel.Legacy
{
- public class MainWindowModel : ViewModelBase
+ public class MainWindowModel : ViewModelBase, ITimeAware
{
public MainWindowModel (Backend backend, Preferences preferences)
{
+ if (backend == null)
+ throw new ArgumentNullException ("backend");
+ if (preferences == null)
+ throw new ArgumentNullException ("preferences");
+
+ UpdateCompletionDateRangeCompareDates ();
+
+ this.backend = backend;
this.preferences = preferences;
- preferences.PropertyChanged += HandlePreferencesPropertyChanged;
-
+
+ Categories = new ReadOnlySortedNotifyCollection<Category> (backend.Categories);
+
tasks = new ListCollectionView<Task> (backend.Tasks);
- SetFilter ();
+ tasks.Filter = Filter;
tasks.GroupDescriptions.Add (new PropertyGroupDescription ("IsComplete"));
var dueDateDesc = new PropertyGroupDescription("DueDate");
dueDateDesc.Converter = new DueDateConverter();
tasks.GroupDescriptions.Add(dueDateDesc);
tasks.CustomSort = new TaskComparer(new TaskCompletionDateComparer());
+
+ addTaskCommand = new AddTaskCommand (backend);
+
}
-
- void HandlePreferencesPropertyChanged (object sender, PropertyChangedEventArgs e)
+
+ public CompletionDateRange CompletionDateRange {
+ get { return preferences.CompletionDateRange; }
+ set {
+ preferences.CompletionDateRange = value;
+ tasks.Refresh ();
+ }
+ }
+
+ public ReadOnlySortedNotifyCollection<Category> Categories { get; private set; }
+
+ public Category SelectedCategory {
+ get { return preferences.SelectedCategory; }
+ set {
+ if (value != null && !Categories.Contains (value))
+ value = null;
+ preferences.SelectedCategory = value;
+ tasks.Refresh ();
+ OnPropertyChanged ("SelectedCategory");
+ }
+ }
+
+ public ICommand AddTask { get { return addTaskCommand; } }
+
+ public string NewTaskName {
+ get { return newTaskName; }
+ set {
+ if (value != newTaskName) {
+ newTaskName = value;
+ addTaskCommand.TaskName = value;
+ OnPropertyChanged ("NewTaskName");
+ }
+ }
+ }
+
+ public Category NewTaskCategory {
+ get { return newTaskCategory; }
+ set {
+ if (value != newTaskCategory) {
+ newTaskCategory = value;
+ addTaskCommand.Category = value;
+ OnPropertyChanged ("NewTaskCategory");
+ }
+ }
+ }
+
+ public ICommand RemoveTask { get { throw new NotImplementedException (); } }
+
+ public string Status {
+ get { return status; }
+ private set {
+ if (value != status) {
+ status = value;
+ OnPropertyChanged ("Status");
+ }
+ }
+ }
+
+ public void OnDayChanged ()
{
- switch (e.PropertyName) {
- case "ShowCompletedTasks":
- SetFilter ();
- break;
+ UpdateCompletionDateRangeCompareDates ();
+ tasks.Refresh ();
+ }
+
+ bool Filter (Task task)
+ {
+ // account for selected category
+ var selectedCategory = SelectedCategory;
+ if (selectedCategory != null && !selectedCategory.Contains (task))
+ return false;
+
+ // account for show completed tasks setting
+ if (!task.IsComplete)
+ return true;
+
+ if (!preferences.ShowCompletedTasks)
+ return false;
+
+ // account for completion date range setting
+ var complDateRange = CompletionDateRange;
+ switch (complDateRange) {
+ case CompletionDateRange.All:
+ return true;
+ case CompletionDateRange.LastYear:
+ return task.CompletionDate >= aYearAgo;
+ case CompletionDateRange.LastMonth:
+ return task.CompletionDate >= aMonthAgo;
+ case CompletionDateRange.Last7Days:
+ return task.CompletionDate >= aWeekAgo;
+ case CompletionDateRange.Yesterday:
+ return task.CompletionDate >= yesterday;
+ default:
+ return true;
}
}
-
- void SetFilter ()
+
+ void UpdateCompletionDateRangeCompareDates ()
{
- if (preferences.ShowCompletedTasks)
- tasks.Filter = null;
- else
- tasks.Filter = task => !task.IsComplete;
+ var today = DateTime.Today.Date;
+ aYearAgo = today.AddYears (-1);
+ aMonthAgo = today.AddMonths (-1);
+ aWeekAgo = today.AddDays (-7);
+ yesterday = today.AddDays (-1);
}
-
+
+ Backend backend;
Preferences preferences;
ListCollectionView<Task> tasks;
+
+ DateTime aYearAgo;
+ DateTime aMonthAgo;
+ DateTime aWeekAgo;
+ DateTime yesterday;
+
+ string status;
+
+ AddTaskCommand addTaskCommand;
+ string newTaskName;
+ Category newTaskCategory;
+
+ RemoveTaskCommand removeTaskCommand;
}
}
diff --git a/src/libtasqueui/Preferences.cs b/src/libtasqueui/Legacy/Preferences.cs
similarity index 76%
rename from src/libtasqueui/Preferences.cs
rename to src/libtasqueui/Legacy/Preferences.cs
index ffc591a..462c61d 100644
--- a/src/libtasqueui/Preferences.cs
+++ b/src/libtasqueui/Legacy/Preferences.cs
@@ -26,10 +26,20 @@
using System;
using System.ComponentModel;
-namespace Tasque.UIModel
+namespace Tasque.UIModel.Legacy
{
public class Preferences : INotifyPropertyChanged
{
+ public CompletionDateRange CompletionDateRange {
+ get { return completionDateRange; }
+ set {
+ if (value != completionDateRange) {
+ completionDateRange = value;
+ OnPropertyChanged ("CompletionDateRange");
+ }
+ }
+ }
+
public bool ShowCompletedTasks {
get { return showCompletedTasks; }
set {
@@ -39,6 +49,16 @@ namespace Tasque.UIModel
}
}
}
+
+ public Category SelectedCategory {
+ get { return selectedCategory; }
+ set {
+ if (value != selectedCategory) {
+ selectedCategory = value;
+ OnPropertyChanged ("SelectedCategory");
+ }
+ }
+ }
public event PropertyChangedEventHandler PropertyChanged;
@@ -48,7 +68,8 @@ namespace Tasque.UIModel
PropertyChanged (this, new PropertyChangedEventArgs (propertyName));
}
+ CompletionDateRange completionDateRange;
bool showCompletedTasks;
+ Category selectedCategory;
}
}
-
diff --git a/src/libtasqueui/Legacy/TaskCommands.cs b/src/libtasqueui/Legacy/TaskCommands.cs
new file mode 100644
index 0000000..c23e071
--- /dev/null
+++ b/src/libtasqueui/Legacy/TaskCommands.cs
@@ -0,0 +1,123 @@
+//
+// TaskCommands.cs
+//
+// Author:
+// Antonius Riha <antoniusriha gmail com>
+//
+// Copyright (c) 2012 Antonius Riha
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+using System;
+using System.Text;
+
+namespace Tasque.UIModel.Legacy
+{
+ class AddTaskCommand : CommandBase
+ {
+ public AddTaskCommand (Backend backend)
+ {
+ if (backend == null)
+ throw new ArgumentNullException ("backend");
+ this.backend = backend;
+ category = backend.DefaultCategory;
+ UpdateCanExecute ();
+ }
+
+ public string TaskName {
+ get { return taskName; }
+ set {
+ if (value != taskName) {
+ taskName = value;
+ UpdateCanExecute ();
+ }
+ }
+ }
+
+ public Category Category {
+ get { return category; }
+ set {
+ if (value != category) {
+ category = value ?? backend.DefaultCategory;
+ UpdateCanExecute ();
+ }
+ }
+ }
+
+ public override void Execute ()
+ {
+ if (CanExecute)
+ backend.CreateTask (taskName, category);
+ }
+
+ void UpdateCanExecute ()
+ {
+ var isTaskNameValid = !string.IsNullOrWhiteSpace (taskName);
+ var isCategoryValid = backend.Categories.Contains (category);
+
+ if (isTaskNameValid && isCategoryValid)
+ SetCanExecute ();
+ else {
+ var errMsg = new StringBuilder ();
+ if (!isTaskNameValid) {
+ errMsg.AppendLine ("TaskName must not be null or white space.");
+ if (!isCategoryValid)
+ errMsg.AppendLine ("Category doesn't belong to backend " + backend.Name);
+ }
+ UnsetCanExecute (errMsg.ToString ());
+ }
+ }
+
+ Backend backend;
+ Category category;
+ string taskName;
+ }
+
+ class RemoveTaskCommand : CommandBase
+ {
+ public RemoveTaskCommand (Backend backend)
+ {
+ if (backend == null)
+ throw new ArgumentNullException ("backend");
+ this.backend = backend;
+ }
+
+ public Task Task {
+ get { return task; }
+ set {
+ if (value == task)
+ return;
+
+ task = value;
+ if (value == null || !backend.Tasks.Contains (value))
+ UnsetCanExecute ("Task doesn't belong to backend " + backend.Name);
+ else
+ SetCanExecute ();
+ }
+ }
+
+ public override void Execute ()
+ {
+ if (CanExecute)
+ backend.DeleteTask (task);
+ }
+
+ Backend backend;
+ Task task;
+ }
+}
diff --git a/src/libtasqueui/Legacy/TaskComparer.cs b/src/libtasqueui/Legacy/TaskComparer.cs
index 1d860af..e8a0154 100644
--- a/src/libtasqueui/Legacy/TaskComparer.cs
+++ b/src/libtasqueui/Legacy/TaskComparer.cs
@@ -40,7 +40,7 @@ namespace Tasque.UIModel.Legacy
var result = x.IsComplete.CompareTo(y.IsComplete);
if (result != 0)
- return -result;
+ return result;
if (x.IsComplete)
return -completedComparer.Compare(x, y);
diff --git a/src/libtasqueui/libtasqueui.csproj b/src/libtasqueui/libtasqueui.csproj
index f8ad60a..2d6972b 100644
--- a/src/libtasqueui/libtasqueui.csproj
+++ b/src/libtasqueui/libtasqueui.csproj
@@ -148,10 +148,15 @@
<Compile Include="CompletedTaskGroupModel.cs" />
<Compile Include="TaskGroupModelFactory.cs" />
<Compile Include="Legacy\TrayModel.cs" />
- <Compile Include="Preferences.cs" />
<Compile Include="Legacy\DueDateCategory.cs" />
<Compile Include="Legacy\DueDateConverter.cs" />
<Compile Include="Legacy\TaskComparer.cs" />
+ <Compile Include="Legacy\CompletionDateRange.cs" />
+ <Compile Include="Legacy\Preferences.cs" />
+ <Compile Include="ITimeAware.cs" />
+ <Compile Include="ICommand.cs" />
+ <Compile Include="CommandBase.cs" />
+ <Compile Include="Legacy\TaskCommands.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
diff --git a/src/tasque/CompletedTaskGroup.cs b/src/tasque/CompletedTaskGroup.cs
index c917f75..ecfc74e 100644
--- a/src/tasque/CompletedTaskGroup.cs
+++ b/src/tasque/CompletedTaskGroup.cs
@@ -3,28 +3,42 @@
//
// To change standard headers go to Edit->Preferences->Coding->Standard Headers
//
-
+//
+// CompletedTaskGroup.cs
+//
+// Author:
+// Antonius Riha <antoniusriha gmail com>
+//
+// Copyright (c) 2012 Antonius Riha
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
using System;
using Gtk;
using Mono.Unix;
-using System.Collections.ObjectModel;
-using System.Collections.Generic;
using System.Linq;
using System.Collections;
using CollectionTransforms;
using System.ComponentModel;
+using Tasque.UIModel.Legacy;
namespace Tasque
{
- public enum ShowCompletedRange : uint
- {
- Yesterday = 0,
- Last7Days,
- LastMonth,
- LastYear,
- All
- }
-
public class CompletedTaskGroup : TaskGroup
{
/// <summary>
@@ -41,7 +55,7 @@ namespace Tasque
Category selectedCategory;
HScale rangeSlider;
- ShowCompletedRange currentRange;
+ CompletionDateRange currentRange;
public CompletedTaskGroup (string groupName, DateTime rangeStart,
DateTime rangeEnd, IEnumerable tasks)
@@ -78,7 +92,7 @@ namespace Tasque
Application.Preferences.Get (Preferences.CompletedTasksRange);
if (rangeStr == null) {
// Set a default value of All
- rangeStr = ShowCompletedRange.All.ToString ();
+ rangeStr = CompletionDateRange.All.ToString ();
Application.Preferences.Set (Preferences.CompletedTasksRange,
rangeStr);
}
@@ -125,7 +139,7 @@ namespace Tasque
private void OnRangeSliderChanged (object sender, EventArgs args)
{
- ShowCompletedRange range = (ShowCompletedRange)(uint)rangeSlider.Value;
+ CompletionDateRange range = (CompletionDateRange)(uint)rangeSlider.Value;
// If the value is different than what we already have, adjust it in
// the UI and set the preference.
@@ -142,38 +156,38 @@ namespace Tasque
private void OnFormatRangeSliderValue (object sender,
FormatValueArgs args)
{
- ShowCompletedRange range = (ShowCompletedRange)args.Value;
+ CompletionDateRange range = (CompletionDateRange)args.Value;
args.RetVal = GetTranslatedRangeValue (range);
}
- private ShowCompletedRange ParseRange (string rangeStr)
+ private CompletionDateRange ParseRange (string rangeStr)
{
switch (rangeStr) {
case "Yesterday":
- return ShowCompletedRange.Yesterday;
+ return CompletionDateRange.Yesterday;
case "Last7Days":
- return ShowCompletedRange.Last7Days;
+ return CompletionDateRange.Last7Days;
case "LastMonth":
- return ShowCompletedRange.LastMonth;
+ return CompletionDateRange.LastMonth;
case "LastYear":
- return ShowCompletedRange.LastYear;
+ return CompletionDateRange.LastYear;
}
// If the string doesn't match for some reason just return the
// default, which is All.
- return ShowCompletedRange.All;
+ return CompletionDateRange.All;
}
- private string GetTranslatedRangeValue (ShowCompletedRange range)
+ private string GetTranslatedRangeValue (CompletionDateRange range)
{
switch (range) {
- case ShowCompletedRange.Yesterday:
+ case CompletionDateRange.Yesterday:
return Catalog.GetString ("Yesterday");
- case ShowCompletedRange.Last7Days:
+ case CompletionDateRange.Last7Days:
return Catalog.GetString ("Last 7 Days");
- case ShowCompletedRange.LastMonth:
+ case CompletionDateRange.LastMonth:
return Catalog.GetString ("Last Month");
- case ShowCompletedRange.LastYear:
+ case CompletionDateRange.LastYear:
return Catalog.GetString ("Last Year");
}
@@ -186,22 +200,22 @@ namespace Tasque
DateTime today = DateTime.Now;
switch (currentRange) {
- case ShowCompletedRange.Yesterday:
+ case CompletionDateRange.Yesterday:
date = today.AddDays (-1);
date = new DateTime (date.Year, date.Month, date.Day,
0, 0, 0);
break;
- case ShowCompletedRange.Last7Days:
+ case CompletionDateRange.Last7Days:
date = today.AddDays (-7);
date = new DateTime (date.Year, date.Month, date.Day,
0, 0, 0);
break;
- case ShowCompletedRange.LastMonth:
+ case CompletionDateRange.LastMonth:
date = today.AddMonths (-1);
date = new DateTime (date.Year, date.Month, date.Day,
0, 0, 0);
break;
- case ShowCompletedRange.LastYear:
+ case CompletionDateRange.LastYear:
date = today.AddYears (-1);
date = new DateTime (date.Year, date.Month, date.Day,
0, 0, 0);
diff --git a/src/tasque/tasque.csproj b/src/tasque/tasque.csproj
index b5dea58..1651fe5 100644
--- a/src/tasque/tasque.csproj
+++ b/src/tasque/tasque.csproj
@@ -159,7 +159,6 @@
</Reference>
<Reference Include="notify-sharp, Version=0.4.0.0, Culture=neutral, PublicKeyToken=2df29c54e245917a">
<Private>False</Private>
- <Package>notify-sharp</Package>
</Reference>
<Reference Include="NDesk.DBus.GLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f6716e4f9b2ed099">
<Private>False</Private>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]