Index: src/TagSelectionWidget.cs
===================================================================
RCS file: /cvs/gnome/f-spot/src/TagSelectionWidget.cs,v
retrieving revision 1.37
diff -u -p -r1.37 TagSelectionWidget.cs
--- src/TagSelectionWidget.cs	2 Mar 2006 02:23:01 -0000	1.37
+++ src/TagSelectionWidget.cs	18 Jul 2006 13:31:08 -0000
@@ -80,6 +80,15 @@ public class TagSelectionWidget : TreeVi
 		selection.Remove (tag.Id);
 	}
 
+	public void SelectTagsForCategory (Category category)
+	{
+		foreach (Tag t in category.Children) {
+			Select (t);
+			if (t is Category)
+				SelectTagsForCategory (t as Category);
+		}	
+	}
+
 	public void UnselectTagsForCategory (Category category)
 	{
 		foreach (Tag t in category.Children) {
@@ -89,14 +98,20 @@ public class TagSelectionWidget : TreeVi
 		}
 	}
 
+	public void UnselectParentsTags (Tag tag)
+	{
+		while (tag.Category != tag_store.RootCategory && IsSelected (tag.Category)) {
+			Unselect (tag.Category);
+			UnselectParentsTags (tag.Category);
+		}	
+	}
+
 	public bool IsSelected (Tag tag)
 	{
 		if (tag == tag_store.RootCategory)
 			return false;
 		else if (selection.ContainsKey (tag.Id))
 			return true;
-		else if (tag.Category != tag_store.RootCategory && IsSelected (tag.Category))
-			return true;
 		else
 			return false;
 	}
@@ -228,20 +243,20 @@ public class TagSelectionWidget : TreeVi
 		uint tag_id = (uint) value;
 		Tag tag = tag_store.Get (tag_id) as Tag;
 
-		// Tags under an unselected category are always conceptually unselected.
-		// They appear as selected just in virtue of being children of a selected category.
-		if (! IsSelected (tag.Category)) {
-			if (IsSelected (tag))
-				Unselect (tag);
-			else
-				Select (tag);
-
-			(Model as TreeStore).EmitRowChanged (path, iter);
-
-			// Make sure that if you unselect the category the tags are unselected as well.
+		//Tag behavior modified !!!
+		if (IsSelected (tag)) {
+			Unselect (tag);
 			if (tag is Category)
 				UnselectTagsForCategory (tag as Category);
+			if (IsSelected(tag.Category))
+				UnselectParentsTags (tag);
+		} else {
+			Select (tag);
+			if (tag is Category)
+				SelectTagsForCategory (tag as Category);
 		}
+
+		(Model as TreeStore).EmitRowChanged (path, iter);
 
 		if (SelectionChanged != null)
 			SelectionChanged (this);
