[longomatch] Add Nationality filed to the UI.
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [longomatch] Add Nationality filed to the UI.
- Date: Tue, 2 Nov 2010 01:14:58 +0000 (UTC)
commit 594b9f0db8f578cd5963609ce119bc684c71bcf7
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date: Mon Oct 25 17:19:02 2010 +0200
Add Nationality filed to the UI.
LongoMatch/Gui/Component/PlayerProperties.cs | 5 +++++
.../Gui/TreeView/PlayerPropertiesTreeView.cs | 14 ++++++++++++++
2 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/LongoMatch/Gui/Component/PlayerProperties.cs b/LongoMatch/Gui/Component/PlayerProperties.cs
index c1f5914..fc9994d 100644
--- a/LongoMatch/Gui/Component/PlayerProperties.cs
+++ b/LongoMatch/Gui/Component/PlayerProperties.cs
@@ -57,6 +57,7 @@ namespace LongoMatch.Gui.Component
this.player = value;
nameentry.Text = value.Name;
positionentry.Text = value.Position;
+ nationalityentry.Text = value.Nationality;
numberspinbutton.Value = value.Number;
weightspinbutton.Value = value.Weight;
heightspinbutton.Value = value.Height;
@@ -157,5 +158,9 @@ namespace LongoMatch.Gui.Component
player.Height = (float)heightspinbutton.Value;
}
+ protected virtual void OnNationalityentryChanged (object sender, System.EventArgs e)
+ {
+ player.Nationality = nationalityentry.Text;
+ }
}
}
diff --git a/LongoMatch/Gui/TreeView/PlayerPropertiesTreeView.cs b/LongoMatch/Gui/TreeView/PlayerPropertiesTreeView.cs
index bffc597..b99fee2 100644
--- a/LongoMatch/Gui/TreeView/PlayerPropertiesTreeView.cs
+++ b/LongoMatch/Gui/TreeView/PlayerPropertiesTreeView.cs
@@ -56,6 +56,11 @@ namespace LongoMatch.Gui.Component
Gtk.CellRendererText birthdayCell = new Gtk.CellRendererText();
birthdayColumn.PackStart(birthdayCell, true);
+ Gtk.TreeViewColumn nationColumn = new Gtk.TreeViewColumn();
+ nationColumn.Title = Catalog.GetString("Nationality");
+ Gtk.CellRendererText nationCell = new Gtk.CellRendererText();
+ nationColumn.PackStart(nationCell, true);
+
Gtk.TreeViewColumn heightColumn = new Gtk.TreeViewColumn();
heightColumn.Title = Catalog.GetString("Height");
Gtk.CellRendererText heightCell = new Gtk.CellRendererText();
@@ -78,6 +83,7 @@ namespace LongoMatch.Gui.Component
photoColumn.SetCellDataFunc(photoCell, new Gtk.TreeCellDataFunc(RenderPhoto));
nameColumn.SetCellDataFunc(nameCell, new Gtk.TreeCellDataFunc(RenderName));
+ nationColumn.SetCellDataFunc(nationCell, new Gtk.TreeCellDataFunc(RenderNationality));
positionColumn.SetCellDataFunc(positionCell, new Gtk.TreeCellDataFunc(RenderPosition));
numberColumn.SetCellDataFunc(numberCell, new Gtk.TreeCellDataFunc(RenderNumber));
heightColumn.SetCellDataFunc(heightCell, new Gtk.TreeCellDataFunc(RenderHeight));
@@ -91,6 +97,7 @@ namespace LongoMatch.Gui.Component
AppendColumn(heightColumn);
AppendColumn(weightColumn);
AppendColumn(birthdayColumn);
+ AppendColumn(nationColumn);
}
private void RenderPhoto(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
@@ -107,6 +114,13 @@ namespace LongoMatch.Gui.Component
(cell as Gtk.CellRendererText).Text = player.Name;
}
+ private void RenderNationality(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
+ {
+ Player player = (Player) model.GetValue(iter, 0);
+
+ (cell as Gtk.CellRendererText).Text = player.Nationality;
+ }
+
private void RenderPosition(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
{
Player player = (Player) model.GetValue(iter, 0);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]