Begin filling in the classes as intended; Fetch the valid accounts and prep them
authorTravis Reitter <travis.reitter@collabora.co.uk>
Mon, 12 Apr 2010 15:37:27 +0000 (08:37 -0700)
committerTravis Reitter <travis.reitter@collabora.co.uk>
Wed, 14 Apr 2010 20:12:46 +0000 (13:12 -0700)
telepathy-people/individual-aggregator.vala
telepathy-people/persona-store.vala

index ef744f6..05f3f29 100644 (file)
  */
 
 using GLib;
+using Tp.PersonaStore;
 
 public class Tp.IndividualAggregator : Object {
+        /* FIXME: cut this?
+        private HashTable stores;
+        */
+
         public IndividualAggregator () {
+                /* FIXME: see if Gee has something better here
+                this.stores = new HashTable ();
+                */
+
+                AccountManager manager = AccountManager.dup ();
+                /* FIXME: cut the GLib */
+                unowned GLib.List<Account> accounts =
+                        manager.get_valid_accounts ();
+
+                /* FIXME: cut this
+                Account first_account = accounts.first().data;
+
+                stdout.printf ("first account: %p (%s: '%s'), presence: %d\n",
+                                first_account,
+                                first_account.get_protocol (),
+                                first_account.get_display_name (),
+                                first_account.get_current_presence (null, null));
+                */
+
+                foreach (Account account in accounts) {
+                        PersonaStore store;
+
+                        /* FIXME: add this to this's hash */
+                        store = new PersonaStore (account);
+
+                }
         }
 
         public void some_method () {
index 949b9ac..90bca99 100644 (file)
 
 using GLib;
 using Tp.Individual;
+using Tp.Channel;
+using Tp.Handle;
+using Tp.Account;
+using Tp.AccountManager;
 
+/* FIXME: split out the TpAccount-specific parts into a new subclass, since
+ * PersonaStore should also be used by non-Telepathy sources */
 public class Tp.PersonaStore : Object {
-        public PersonaStore () {
-        }
-
-        /* FIXME: cut this */
-        public void some_method () {
-                Individual individual = new Individual ();
+        [Property(nick = "basis account",
+                        blurb = "Telepathy account this store is based upon")]
+        public Account account { get; construct; }
 
+        public PersonaStore (Account account) {
                 /* FIXME: cut this */
-                stdout.printf ("telepathy-people says hello with individual %p!\n",
-                                individual);
+                stdout.printf ("creating PersonaStore from account: %p (%s: '%s'), presence: %d\n",
+                               account,
+                               account.get_protocol (),
+                               account.get_display_name (),
+                               account.get_current_presence (null, null));
+
+                Object (account: account);
         }
 }