Mercurial > pidgin
comparison src/conversation.c @ 10824:8d52201620d0
[gaim-migrate @ 12488]
This changes gaim_conv_window_remove_conversation to take a GaimConversion
pointer to remore instead of an index. Every place just called a function
to get the index before calling it anyway.
This may or may not help the contact aware convo bugs, I didn't test it
yet, but I believe it to be a step in the right direction.
committer: Tailor Script <tailor@pidgin.im>
author | Tim Ringenbach <marv@pidgin.im> |
---|---|
date | Fri, 15 Apr 2005 00:28:54 +0000 |
parents | 4151d16f6348 |
children | 53e7884c549a |
comparison
equal
deleted
inserted
replaced
10823:c1bb12625b3f | 10824:8d52201620d0 |
---|---|
466 g_return_val_if_fail(conv != NULL, -1); | 466 g_return_val_if_fail(conv != NULL, -1); |
467 | 467 |
468 if (gaim_conversation_get_window(conv) != NULL) { | 468 if (gaim_conversation_get_window(conv) != NULL) { |
469 gaim_conv_window_remove_conversation( | 469 gaim_conv_window_remove_conversation( |
470 gaim_conversation_get_window(conv), | 470 gaim_conversation_get_window(conv), |
471 gaim_conversation_get_index(conv)); | 471 conv); |
472 } | 472 } |
473 | 473 |
474 ops = gaim_conv_window_get_ui_ops(win); | 474 ops = gaim_conv_window_get_ui_ops(win); |
475 | 475 |
476 win->conversations = g_list_append(win->conversations, conv); | 476 win->conversations = g_list_append(win->conversations, conv); |
490 | 490 |
491 return win->conversation_count - 1; | 491 return win->conversation_count - 1; |
492 } | 492 } |
493 | 493 |
494 GaimConversation * | 494 GaimConversation * |
495 gaim_conv_window_remove_conversation(GaimConvWindow *win, unsigned int index) | 495 gaim_conv_window_remove_conversation(GaimConvWindow *win, GaimConversation *conv) |
496 { | 496 { |
497 GaimConvWindowUiOps *ops; | 497 GaimConvWindowUiOps *ops; |
498 GaimConversation *conv; | |
499 GList *node; | 498 GList *node; |
500 | 499 |
501 g_return_val_if_fail(win != NULL, NULL); | 500 g_return_val_if_fail(win != NULL, NULL); |
502 g_return_val_if_fail(index < gaim_conv_window_get_conversation_count(win), NULL); | 501 g_return_val_if_fail(conv != NULL, NULL); |
503 | 502 |
504 ops = gaim_conv_window_get_ui_ops(win); | 503 ops = gaim_conv_window_get_ui_ops(win); |
505 | 504 |
506 node = g_list_nth(gaim_conv_window_get_conversations(win), index); | 505 node = g_list_find(gaim_conv_window_get_conversations(win), conv); |
507 conv = (GaimConversation *)node->data; | 506 |
508 | 507 if (!node) |
508 return NULL; | |
509 | |
509 if (ops != NULL && ops->remove_conversation != NULL) | 510 if (ops != NULL && ops->remove_conversation != NULL) |
510 ops->remove_conversation(win, conv); | 511 ops->remove_conversation(win, conv); |
511 | 512 |
512 win->conversations = g_list_remove_link(win->conversations, node); | 513 win->conversations = g_list_remove_link(win->conversations, node); |
513 | 514 |
1017 | 1018 |
1018 g_hash_table_destroy(conv->data); | 1019 g_hash_table_destroy(conv->data); |
1019 conv->data = NULL; | 1020 conv->data = NULL; |
1020 | 1021 |
1021 if (win != NULL) { | 1022 if (win != NULL) { |
1022 gaim_conv_window_remove_conversation(win, | 1023 gaim_conv_window_remove_conversation(win, conv); |
1023 gaim_conversation_get_index(conv)); | |
1024 } | 1024 } |
1025 | 1025 |
1026 if (ops != NULL && ops->destroy_conversation != NULL) | 1026 if (ops != NULL && ops->destroy_conversation != NULL) |
1027 ops->destroy_conversation(conv); | 1027 ops->destroy_conversation(conv); |
1028 | 1028 |