pidgin/plugins/gevolution/gevo-util.c

branch
soc.2013.gobjectification.plugins
changeset 37109
94d1a2589d5a
parent 37049
02db93eb6506
parent 35522
82139d173179
child 37143
728319cb659f
equal deleted inserted replaced
37108:73c5fb6d78b3 37109:94d1a2589d5a
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;

mercurial