pidgin/plugins/gevolution/add_buddy_dialog.c

changeset 15884
4de1981757fc
parent 15577
b8129373f65e
child 16238
33bf2fd32108
child 17213
25a0ae0d0ff7
child 18068
b6554e3c8224
child 20478
46933dc62880
equal deleted inserted replaced
15883:969b74a3e27a 15884:4de1981757fc
1 /* 1 /*
2 * Evolution integration plugin for Gaim 2 * Evolution integration plugin for Purple
3 * 3 *
4 * Copyright (C) 2003 Christian Hammond. 4 * Copyright (C) 2003 Christian Hammond.
5 * 5 *
6 * This program is free software; you can redistribute it and/or 6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as 7 * modify it under the terms of the GNU General Public License as
159 159
160 static void 160 static void
161 add_ims(GevoAddBuddyDialog *dialog, EContact *contact, const char *name, 161 add_ims(GevoAddBuddyDialog *dialog, EContact *contact, const char *name,
162 GList *list, const char *id) 162 GList *list, const char *id)
163 { 163 {
164 GaimAccount *account = NULL; 164 PurpleAccount *account = NULL;
165 GList *l; 165 GList *l;
166 GtkTreeIter iter; 166 GtkTreeIter iter;
167 GdkPixbuf *pixbuf; 167 GdkPixbuf *pixbuf;
168 168
169 if (list == NULL) 169 if (list == NULL)
170 return; 170 return;
171 171
172 for (l = gaim_connections_get_all(); l != NULL; l = l->next) 172 for (l = purple_connections_get_all(); l != NULL; l = l->next)
173 { 173 {
174 GaimConnection *gc = (GaimConnection *)l->data; 174 PurpleConnection *gc = (PurpleConnection *)l->data;
175 175
176 account = gaim_connection_get_account(gc); 176 account = purple_connection_get_account(gc);
177 177
178 if (!strcmp(gaim_account_get_protocol_id(account), id)) 178 if (!strcmp(purple_account_get_protocol_id(account), id))
179 break; 179 break;
180 180
181 account = NULL; 181 account = NULL;
182 } 182 }
183 183
191 char *account_name = (char *)l->data; 191 char *account_name = (char *)l->data;
192 192
193 if (account_name == NULL) 193 if (account_name == NULL)
194 continue; 194 continue;
195 195
196 if (gaim_find_buddy(dialog->account, account_name) != NULL) 196 if (purple_find_buddy(dialog->account, account_name) != NULL)
197 continue; 197 continue;
198 198
199 gtk_list_store_append(dialog->model, &iter); 199 gtk_list_store_append(dialog->model, &iter);
200 200
201 gtk_list_store_set(dialog->model, &iter, 201 gtk_list_store_set(dialog->model, &iter,
203 COLUMN_PRPL_ICON, pixbuf, 203 COLUMN_PRPL_ICON, pixbuf,
204 COLUMN_USERNAME, account_name, 204 COLUMN_USERNAME, account_name,
205 COLUMN_DATA, contact, 205 COLUMN_DATA, contact,
206 -1); 206 -1);
207 207
208 if (!strcmp(gaim_account_get_protocol_id(account), 208 if (!strcmp(purple_account_get_protocol_id(account),
209 gaim_account_get_protocol_id(dialog->account)) && 209 purple_account_get_protocol_id(dialog->account)) &&
210 dialog->username != NULL && 210 dialog->username != NULL &&
211 !strcmp(account_name, dialog->username)) 211 !strcmp(account_name, dialog->username))
212 { 212 {
213 GtkTreeSelection *selection; 213 GtkTreeSelection *selection;
214 214
250 250
251 gtk_list_store_clear(dialog->model); 251 gtk_list_store_clear(dialog->model);
252 252
253 if (!gevo_load_addressbook(uri, &book, NULL)) 253 if (!gevo_load_addressbook(uri, &book, NULL))
254 { 254 {
255 gaim_debug_error("evolution", 255 purple_debug_error("evolution",
256 "Error retrieving default addressbook\n"); 256 "Error retrieving default addressbook\n");
257 257
258 return; 258 return;
259 } 259 }
260 260
261 query = e_book_query_field_exists(E_CONTACT_FULL_NAME); 261 query = e_book_query_field_exists(E_CONTACT_FULL_NAME);
262 262
263 if (query == NULL) 263 if (query == NULL)
264 { 264 {
265 gaim_debug_error("evolution", "Error in creating query\n"); 265 purple_debug_error("evolution", "Error in creating query\n");
266 266
267 g_object_unref(book); 267 g_object_unref(book);
268 268
269 return; 269 return;
270 } 270 }
273 273
274 e_book_query_unref(query); 274 e_book_query_unref(query);
275 275
276 if (!status) 276 if (!status)
277 { 277 {
278 gaim_debug_error("evolution", "Error %d in getting card list\n", 278 purple_debug_error("evolution", "Error %d in getting card list\n",
279 status); 279 status);
280 280
281 g_object_unref(book); 281 g_object_unref(book);
282 282
283 return; 283 return;
416 gtk_entry_set_text(GTK_ENTRY(dialog->search_field), ""); 416 gtk_entry_set_text(GTK_ENTRY(dialog->search_field), "");
417 lock = FALSE; 417 lock = FALSE;
418 } 418 }
419 419
420 void 420 void
421 gevo_add_buddy_dialog_show(GaimAccount *account, const char *username, 421 gevo_add_buddy_dialog_show(PurpleAccount *account, const char *username,
422 const char *group, const char *alias) 422 const char *group, const char *alias)
423 { 423 {
424 GevoAddBuddyDialog *dialog; 424 GevoAddBuddyDialog *dialog;
425 GtkWidget *button; 425 GtkWidget *button;
426 GtkWidget *sw; 426 GtkWidget *sw;
435 dialog = g_new0(GevoAddBuddyDialog, 1); 435 dialog = g_new0(GevoAddBuddyDialog, 1);
436 436
437 dialog->account = 437 dialog->account =
438 (account != NULL 438 (account != NULL
439 ? account 439 ? account
440 : gaim_connection_get_account(gaim_connections_get_all()->data)); 440 : purple_connection_get_account(purple_connections_get_all()->data));
441 441
442 if (username != NULL) 442 if (username != NULL)
443 dialog->username = g_strdup(username); 443 dialog->username = g_strdup(username);
444 444
445 dialog->win = gtk_window_new(GTK_WINDOW_TOPLEVEL); 445 dialog->win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
609 } 609 }
610 610
611 void 611 void
612 gevo_add_buddy_dialog_add_person(GevoAddBuddyDialog *dialog, 612 gevo_add_buddy_dialog_add_person(GevoAddBuddyDialog *dialog,
613 EContact *contact, const char *name, 613 EContact *contact, const char *name,
614 GaimAccount *account, const char *screenname) 614 PurpleAccount *account, const char *screenname)
615 { 615 {
616 GdkPixbuf *pixbuf; 616 GdkPixbuf *pixbuf;
617 GtkTreeIter iter; 617 GtkTreeIter iter;
618 618
619 pixbuf = pidgin_create_prpl_icon(account, 0.5); 619 pixbuf = pidgin_create_prpl_icon(account, 0.5);

mercurial