[hyena] ListViewTestModule: Refactor Model class to inherit from BaseListModel
- From: Bertrand Lorentz <blorentz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [hyena] ListViewTestModule: Refactor Model class to inherit from BaseListModel
- Date: Fri, 15 Aug 2014 11:21:08 +0000 (UTC)
commit d20342107425e71e77541aea16558f146322e570
Author: Bertrand Lorentz <bertrand lorentz gmail com>
Date: Fri Aug 15 13:14:45 2014 +0200
ListViewTestModule: Refactor Model class to inherit from BaseListModel
Mono 3.6.0 was warning about the Cleared and Reloaded event not being
used, so instead of adding a dummy implementation of OnCleared and
OnReloaded, we inherit from BaseListModel. This allows to make the Model
class even simpler.
Hyena.Gui/Hyena.Data.Gui/ListViewTestModule.cs | 30 ++++++-----------------
1 files changed, 8 insertions(+), 22 deletions(-)
---
diff --git a/Hyena.Gui/Hyena.Data.Gui/ListViewTestModule.cs b/Hyena.Gui/Hyena.Data.Gui/ListViewTestModule.cs
index 09ba363..fb04127 100644
--- a/Hyena.Gui/Hyena.Data.Gui/ListViewTestModule.cs
+++ b/Hyena.Gui/Hyena.Data.Gui/ListViewTestModule.cs
@@ -170,13 +170,9 @@ namespace Hyena.Data.Gui.Tests
}
}
- internal class Model : IListModel<ModelItem>
+ internal class Model : BaseListModel<ModelItem>
{
private List<ModelItem> store = new List<ModelItem> ();
- private Selection selection = new Selection ();
-
- public event EventHandler Cleared;
- public event EventHandler Reloaded;
public Model (int items)
{
@@ -186,34 +182,24 @@ namespace Hyena.Data.Gui.Tests
}
}
- public void Clear ()
- {
- }
-
- public void Reload ()
+ public override void Clear ()
{
+ store.Clear ();
+ OnCleared ();
}
- public object GetItem (int index)
+ public override void Reload ()
{
- return this[index];
+ OnReloaded ();
}
- public int Count {
+ public override int Count {
get { return store.Count; }
}
- public bool CanReorder {
- get { return false; }
- }
-
- public ModelItem this[int index] {
+ public override ModelItem this[int index] {
get { return store[index]; }
}
-
- public Selection Selection {
- get { return selection; }
- }
}
internal class ModelItem
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]