| 124 { |
124 { |
| 125 return (gevo_protocol_get_field(account, buddy) != 0); |
125 return (gevo_protocol_get_field(account, buddy) != 0); |
| 126 } |
126 } |
| 127 |
127 |
| 128 gboolean |
128 gboolean |
| 129 gevo_load_addressbook(const gchar* uri, EBook **book, GError **error) |
129 gevo_load_addressbook(const gchar* uid, EBook **book, GError **error) |
| 130 { |
130 { |
| 131 gboolean result = FALSE; |
131 gboolean result = FALSE; |
| |
132 ESourceRegistry *registry; |
| |
133 ESource *source; |
| 132 |
134 |
| 133 g_return_val_if_fail(book != NULL, FALSE); |
135 g_return_val_if_fail(book != NULL, FALSE); |
| 134 |
136 |
| 135 if (uri == NULL) |
137 registry = e_source_registry_new_sync(NULL, error); |
| 136 *book = e_book_new_system_addressbook(error); |
138 |
| |
139 if (!registry) |
| |
140 return FALSE; |
| |
141 |
| |
142 if (uid == NULL) |
| |
143 source = e_source_registry_ref_default_address_book(registry); |
| 137 else |
144 else |
| 138 *book = e_book_new_from_uri(uri, error); |
145 source = e_source_registry_ref_source(registry, uid); |
| |
146 |
| |
147 g_object_unref(registry); |
| |
148 |
| |
149 result = gevo_load_addressbook_from_source(source, book, error); |
| |
150 |
| |
151 g_object_unref(source); |
| |
152 |
| |
153 return result; |
| |
154 } |
| |
155 |
| |
156 gboolean |
| |
157 gevo_load_addressbook_from_source(ESource *source, EBook **book, GError **error) |
| |
158 { |
| |
159 gboolean result = FALSE; |
| |
160 |
| |
161 *book = e_book_new(source, error); |
| 139 |
162 |
| 140 if (*book == NULL) |
163 if (*book == NULL) |
| 141 return FALSE; |
164 return FALSE; |
| 142 |
165 |
| 143 *error = NULL; |
166 *error = NULL; |