~people-project/people-glib/trunk

« back to all changes in this revision

Viewing changes to people-glib/contact.vala

  • Committer: Ali Sabil
  • Date: 2009-02-05 15:55:50 UTC
  • Revision ID: ali.sabil@gmail.com-20090205155550-1zr4xitssny1zc42
Improved the Contact implementation to use the get_identifier () method

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
        [DBus (name = "net.launchpad.People.Contact")]
24
24
        private interface IContact : DBus.Object {
25
25
                //public abstract string id { get; }
 
26
                public abstract string get_identifier ();
26
27
 
27
28
                public abstract signal void defined_fields_retrieved (string[] fields);
28
29
                public abstract signal void fields_retrieved (HashTable<string, string> fields);
37
38
                        construct;
38
39
                }
39
40
 
 
41
                public string bus_name {
 
42
                        private get;
 
43
                        construct;
 
44
                }
 
45
 
 
46
                public string object_path {
 
47
                        private get;
 
48
                        construct;
 
49
                }
 
50
 
 
51
                public string id {
 
52
                        get {
 
53
                                if (_id == null)
 
54
                                        _id = contact.get_identifier ();
 
55
                                return _id;
 
56
                        }
 
57
                }
 
58
 
 
59
                public signal void defined_fields_retrieved (string[] fields);
 
60
                public signal void fields_retrieved (HashTable<string, string> fields);
 
61
 
 
62
                private string _id = null;
40
63
                private IContact contact;
41
64
 
 
65
                construct {
 
66
                        this.contact = connection.get_object (bus_name, object_path) as IContact;
 
67
                        this.contact.defined_fields_retrieved += on_defined_fields_retrieved;
 
68
                        this.contact.fields_retrieved += on_fields_retrieved;
 
69
                }
 
70
 
42
71
                public Contact (DBus.Connection connection, string bus_name, string object_path) {
43
72
                        this.connection = connection;
44
 
                        this.contact = connection.get_object (bus_name, object_path) as IContact;
45
 
                }
46
 
 
47
 
                public string id {
48
 
                        public get;
49
 
                        private set;
50
 
                }
51
 
 
52
 
                public signal void defined_fields_retrieved (string[] fields);
53
 
                public signal void fields_retrieved (HashTable<string, string> fields);
 
73
                        this.bus_name = bus_name;
 
74
                        this.object_path = object_path;
 
75
                }
54
76
 
55
77
                public void request_defined_fields () {
 
78
                        this.contact.request_defined_fields ();
56
79
                }
57
80
 
58
81
                public void request_fields (string[] fields) {
 
82
                        this.contact.request_fields (fields);
 
83
                }
 
84
 
 
85
                private void on_defined_fields_retrieved (dynamic DBus.Object contact, string[] fields) {
 
86
                        this.defined_fields_retrieved (fields);
 
87
                }
 
88
 
 
89
                private void on_fields_retrieved (dynamic DBus.Object contact, HashTable<string, string> fields) {
 
90
                        this.fields_retrieved (fields);
59
91
                }
60
92
        }
61
93
}