blam r654 - in trunk: . src



Author: cmartin
Date: Thu Sep 18 17:07:15 2008
New Revision: 654
URL: http://svn.gnome.org/viewvc/blam?rev=654&view=rev

Log:
Remove groups and channels inside groups.

Check where the channel/group we are looking for exists and delete it
from there instead of blindly removing it from top-level.

Modified:
   trunk/ChangeLog
   trunk/src/ChannelCollection.cs

Modified: trunk/src/ChannelCollection.cs
==============================================================================
--- trunk/src/ChannelCollection.cs	(original)
+++ trunk/src/ChannelCollection.cs	Thu Sep 18 17:07:15 2008
@@ -177,7 +177,20 @@
 
 	public void Remove (IChannel channel)
 	{
-	    mChannels.Remove (channel);
+        /* Try to find out from which list we need to remove. */
+        if(mChannels.Contains(channel)){
+            mChannels.Remove (channel);
+        } else if(Groups.Contains(channel)){
+            Groups.Remove(channel);
+        } else {
+            /* It's not a first-level channel or group. Dig deeper. */
+            foreach(ChannelGroup group in Groups){
+                if(group.Channels.Contains(channel)){
+                    group.Channels.Remove(channel);
+                    break;
+                }
+            }
+        }
 
 	    if (ChannelRemoved != null) {
 		ChannelRemoved (channel);



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