2
* Copyright (C) 2012 Canonical, Ltd.
5
* Renato Araujo Oliveira Filho <renato@canonical.com>
7
* This program is free software; you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation; version 3.
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program. If not, see <http://www.gnu.org/licenses/>.
23
using SocialWebClient;
25
namespace Unity.Contacts {
26
public class ContactList : GLib.Object
28
private Folks.IndividualAggregator aggregator;
32
GLib.Timeout.add(100, list_all);
35
private void initialize_folks ()
37
aggregator = new Folks.IndividualAggregator();
41
private void dump_social_web(Contact contact)
43
stdout.printf ("\tLibsocialweb: %s\n", contact.uuid);
44
foreach(var prop_name in contact.props.get_keys()) {
45
stdout.printf ("\t\tprop %s: %s\n",
47
contact.get_value(prop_name));
51
public bool list_all ()
53
stdout.printf ("Started contact list.\n");
55
var contacts = aggregator.individuals.values;
56
foreach (var contact in contacts) {
57
stdout.printf ("\nContact:\n\tNickname: %s\n\tAlias: %s\n\tFull Name: %s\n",
58
contact.nickname, contact.alias, contact.full_name);
61
foreach(var email in contact.email_addresses) {
62
stdout.printf("\tEmail: %s\n", email.value);
64
foreach (var persona in contact.personas) {
65
stdout.printf("Persona:\n");
66
Value prop_value = new Contact();
67
persona.get_property("lsw_contact", ref prop_value);
68
Contact c = (Contact) prop_value;
74
stdout.printf ("DONE\n");