[longomatch/redesign3: 116/156] Add handler for deleted subcategories



commit 7f9e1d51ed6f359b738e76e45e282de95f2791f1
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Sat Apr 9 18:08:26 2011 +0200

    Add handler for deleted subcategories

 LongoMatch/Gui/TreeView/SubCategoriesTreeView.cs |   12 ++++++++++++
 LongoMatch/Handlers/Handlers.cs                  |    2 ++
 2 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/LongoMatch/Gui/TreeView/SubCategoriesTreeView.cs b/LongoMatch/Gui/TreeView/SubCategoriesTreeView.cs
index fbc180a..3dea198 100644
--- a/LongoMatch/Gui/TreeView/SubCategoriesTreeView.cs
+++ b/LongoMatch/Gui/TreeView/SubCategoriesTreeView.cs
@@ -16,10 +16,13 @@
 //  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
 // 
 using System;
+using System.Collections.Generic;
+
 using Gtk;
 using Gdk;
 
 using LongoMatch.Interfaces;
+using LongoMatch.Handlers;
 
 namespace LongoMatch.Gui
 {
@@ -28,6 +31,8 @@ namespace LongoMatch.Gui
 	[System.ComponentModel.ToolboxItem(true)]
 	public class SubCategoriesTreeView: TreeView
 	{
+		public event SubCategoriesHandler SubCategoriesDeleted;
+		
 		private Menu menu;
 		private TreeIter selectedIter;
 		
@@ -52,6 +57,13 @@ namespace LongoMatch.Gui
 		}
 
 		protected void OnRemove(object obj, EventArgs args) {
+			/* FIXME: Support multiselection for multideletion */
+			List<ISubCategory> l = new List<ISubCategory>();
+				
+			if (this.SubCategoriesDeleted != null) {
+				l.Add((ISubCategory)Model.GetValue(selectedIter, 0));
+				SubCategoriesDeleted(l);
+			}
 			(Model as ListStore).Remove(ref selectedIter);
 		}
 		
diff --git a/LongoMatch/Handlers/Handlers.cs b/LongoMatch/Handlers/Handlers.cs
index bbf0f3b..f9fe67e 100644
--- a/LongoMatch/Handlers/Handlers.cs
+++ b/LongoMatch/Handlers/Handlers.cs
@@ -22,6 +22,7 @@ using System;
 using System.Collections.Generic;
 using LongoMatch;
 using LongoMatch.DB;
+using LongoMatch.Interfaces;
 using LongoMatch.Store;
 using LongoMatch.Common;
 
@@ -85,6 +86,7 @@ namespace LongoMatch.Handlers
 
 	public delegate void CategoryHandler(Category category);
 	public delegate void CategoriesHandler(List<Category> categoriesList);
+	public delegate void SubCategoriesHandler(List<ISubCategory> subcat);
 
 	public delegate void ProjectsSelectedHandler(List<ProjectDescription> projects);
 }



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