blam r627 - trunk/src



Author: cmartin
Date: Sun Sep  7 10:42:38 2008
New Revision: 627
URL: http://svn.gnome.org/viewvc/blam?rev=627&view=rev

Log:
Initial implementation of channel groups.

A standard interface has to be set up in order to show
this properly in the GUI.

Added:
   trunk/src/ChannelGroup.cs
Modified:
   trunk/src/ChannelCollection.cs
   trunk/src/Makefile.am

Modified: trunk/src/ChannelCollection.cs
==============================================================================
--- trunk/src/ChannelCollection.cs	(original)
+++ trunk/src/ChannelCollection.cs	Sun Sep  7 10:42:38 2008
@@ -46,6 +46,8 @@
 	    }
 	}
 
+	[XmlElement("Group", typeof(ChannelGroup))] public ArrayList Groups;
+
 	public int NrOfUnreadItems {
 	    get {
 		int unread = 0;
@@ -53,6 +55,10 @@
 		foreach (Channel channel in mChannels) {
 		    unread += channel.NrOfUnreadItems;
 		}
+
+        foreach (ChannelGroup changrp in Groups) {
+            unread += changrp.NrOfUnreadItems;
+        }
 		
 		return unread;
 	    }

Added: trunk/src/ChannelGroup.cs
==============================================================================
--- (empty file)
+++ trunk/src/ChannelGroup.cs	Sun Sep  7 10:42:38 2008
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2008 Carlos MartÃn Nieto <carlos cmartin tk>
+ * 
+ * This file is released under the GNU GPL v2 or later.
+ */
+
+using System;
+using System.Collections;
+using System.Xml.Serialization;
+
+namespace Imendio.Blam
+{
+    [XmlType("group")]
+    public class ChannelGroup
+    {
+        [XmlAttribute] public string Name = null;
+        [XmlElement("Channel", typeof(Channel))] public ArrayList Channels;
+        
+        public int NrOfUnreadItems {
+            get {
+                int nr = 0;
+                foreach(Channel channel in Channels){
+                    nr += channel.NrOfUnreadItems;
+                }
+
+                return nr;
+            }
+        }
+
+        public int NrOfItems {
+            get {
+                int n = 0;
+                foreach(Channel channel in Channels){
+                    n += channel.NrOfItems;
+                }
+                
+                return n;
+            }
+        }
+    }
+}

Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am	(original)
+++ trunk/src/Makefile.am	Sun Sep  7 10:42:38 2008
@@ -17,6 +17,7 @@
 	       ChannelDialog.cs \
 	       Channel.cs \
 	       ChannelCollection.cs \
+               ChannelGroup.cs \
 	       ChannelList.cs \
 	       Conf.cs \
 	       Delegates.cs \



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