Disable AudioComponent do get everything to build nicely.
[chatter.git] / AccountStore.cs
blob6b07ae08f0a13552a659fd5068c4b3d3c6107ff0
1 using System;
2 using System.Collections;
3 using System.Xml.Serialization;
5 namespace Chatter
7 public class AccountStore
9 ArrayList account_list = new ArrayList ();
11 public AccountStore () { }
13 public int Count
15 get { return account_list.Count; }
18 public void AddAccount (AccountModel account)
20 account_list.Add (account);
21 if (AccountAdded != null) AccountAdded (account);
22 FireCommitRequired (false);
23 account.Changed += AccountChangedHandler;
26 public void RemoveAccount (AccountModel account)
28 account.Changed -= AccountChangedHandler;
29 account_list.Remove (account);
30 if (AccountRemoved != null) AccountRemoved (account);
31 FireCommitRequired (false);
34 public void LinkAccounts () {
35 foreach (AccountModel account in account_list)
36 account.Changed += AccountChangedHandler;
39 void AccountChangedHandler (AccountModel account) {
40 if (AccountChanged != null) AccountChanged (account);
41 FireCommitRequired (false);
44 [XmlElement ("Account")]
45 public AccountModel [] Accounts
47 get
49 AccountModel [] accounts = new AccountModel [account_list.Count];
50 account_list.CopyTo (accounts);
51 return accounts;
53 set
55 foreach (AccountModel account in value)
56 account_list.Add (account);
60 public void FireCommitRequired (bool now)
62 if (CommitRequired != null) CommitRequired (this, now);
65 public event AccountModelDelegate AccountAdded;
66 public event AccountModelDelegate AccountRemoved;
67 public event AccountModelDelegate AccountChanged;
69 public event StateCommitHandler CommitRequired;