~iwarford/do-plugins/inline-google-fix

« back to all changes in this revision

Viewing changes to GMailContacts/src/GMailContactItemSource.cs

  • Committer: Alex Launi
  • Date: 2008-07-01 20:02:42 UTC
  • mfrom: (151.1.24 do-plugins)
  • Revision ID: alex@eriktorvaldsonn-20080701200242-l85j12hkp0os19tb
merge

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
{       
32
32
        public sealed class GMailContactsItemSource : IItemSource, IConfigurable
33
33
        {
34
 
                private List<IItem> items;
35
 
                
36
 
                public GMailContactsItemSource()
37
 
                {
38
 
                        items = new List<IItem> ();
39
 
                }
40
 
                
41
34
                public string Name { 
42
35
                        get { return "GMail Contacts"; }
43
36
                }
59
52
                }
60
53
                
61
54
                public ICollection<IItem> Items {
62
 
                        get { return items; }
 
55
                        get { return GMail.Contacts; }
63
56
                }
64
57
                
65
58
                public ICollection<IItem> ChildrenOfItem (IItem item) 
66
59
                {
67
 
                        ContactItem contact = (item as ContactItem);
68
 
                        List<IItem> details;
69
 
                        
70
 
                        details = new List<IItem> ();
 
60
                        ContactItem contact = item as ContactItem;
 
61
                        List<IItem> details = new List<IItem> ();
71
62
                        foreach (string detail in contact.Details) {
72
 
                                if (detail.Contains ("."))
73
 
                                        details.Add (new GMailContactDetailItem (
74
 
                                                detail, contact [detail]));
 
63
                                if (detail.Contains (".gmail"))
 
64
                                        details.Add (
 
65
                                                new GMailContactDetailItem (detail, contact [detail]));
75
66
                        }
76
67
                        return details;
77
68
                }
82
73
                                Thread thread = new Thread ((ThreadStart) (GMail.UpdateContacts));
83
74
                                thread.IsBackground = true;
84
75
                                thread.Start ();
85
 
                                items = GMail.Contacts;
86
76
                        } catch (Exception e) {
87
77
                                Console.Error.WriteLine (e.Message);
88
78
                        }