changeset 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 c1bb12625b3f
children cb625efd1071
files plugins/ChangeLog.API plugins/gestures/gestures.c src/conversation.c src/conversation.h src/gtkconv.c
diffstat 5 files changed, 19 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/ChangeLog.API	Thu Apr 14 04:08:10 2005 +0000
+++ b/plugins/ChangeLog.API	Fri Apr 15 00:28:54 2005 +0000
@@ -56,6 +56,8 @@
 	           non-NULL value. This value is now returned. Previously,
 	           all registered handlers were called and the value from the
 	           last handler was used.
+	* Changed: gaim_conv_window_remove_conversation()'s last argument to
+	           be a GaimConversation.
 
 version 1.0.0 (09/17/2004):
 	* Added: get_chat_name to the GaimPluginProtocolInfo struct
--- a/plugins/gestures/gestures.c	Thu Apr 14 04:08:10 2005 +0000
+++ b/plugins/gestures/gestures.c	Fri Apr 15 00:28:54 2005 +0000
@@ -104,7 +104,7 @@
 
 	new_win = gaim_conv_window_new();
 
-	gaim_conv_window_remove_conversation(old_win, gaim_conversation_get_index(conv));
+	gaim_conv_window_remove_conversation(old_win, conv);
 	gaim_conv_window_add_conversation(new_win, conv);
 
 	gaim_conv_window_show(new_win);
--- a/src/conversation.c	Thu Apr 14 04:08:10 2005 +0000
+++ b/src/conversation.c	Fri Apr 15 00:28:54 2005 +0000
@@ -468,7 +468,7 @@
 	if (gaim_conversation_get_window(conv) != NULL) {
 		gaim_conv_window_remove_conversation(
 			gaim_conversation_get_window(conv),
-			gaim_conversation_get_index(conv));
+			conv);
 	}
 
 	ops = gaim_conv_window_get_ui_ops(win);
@@ -492,20 +492,21 @@
 }
 
 GaimConversation *
-gaim_conv_window_remove_conversation(GaimConvWindow *win, unsigned int index)
+gaim_conv_window_remove_conversation(GaimConvWindow *win, GaimConversation *conv)
 {
 	GaimConvWindowUiOps *ops;
-	GaimConversation *conv;
 	GList *node;
 
 	g_return_val_if_fail(win != NULL, NULL);
-	g_return_val_if_fail(index < gaim_conv_window_get_conversation_count(win), NULL);
+	g_return_val_if_fail(conv != NULL, NULL);
 
 	ops = gaim_conv_window_get_ui_ops(win);
 
-	node = g_list_nth(gaim_conv_window_get_conversations(win), index);
-	conv = (GaimConversation *)node->data;
-
+	node = g_list_find(gaim_conv_window_get_conversations(win), conv);
+
+	if (!node)
+		return NULL;
+	
 	if (ops != NULL && ops->remove_conversation != NULL)
 		ops->remove_conversation(win, conv);
 
@@ -1019,8 +1020,7 @@
 	conv->data = NULL;
 
 	if (win != NULL) {
-		gaim_conv_window_remove_conversation(win,
-			gaim_conversation_get_index(conv));
+		gaim_conv_window_remove_conversation(win, conv);
 	}
 
 	if (ops != NULL && ops->destroy_conversation != NULL)
--- a/src/conversation.h	Thu Apr 14 04:08:10 2005 +0000
+++ b/src/conversation.h	Fri Apr 15 00:28:54 2005 +0000
@@ -402,17 +402,15 @@
 									  GaimConversation *conv);
 
 /**
- * Removes the conversation at the specified index from the window.
- *
- * If there is no conversation at this index, this will do nothing.
+ * Removes the conversation from the window.
  *
  * @param win   The window.
- * @param index The index of the conversation.
+ * @param conv The conversation.
  *
  * @return The conversation removed.
  */
 GaimConversation *gaim_conv_window_remove_conversation(GaimConvWindow *win,
-													   unsigned int index);
+                                                       GaimConversation *conv);
 
 /**
  * Moves the conversation at the specified index in a window to a new index.
--- a/src/gtkconv.c	Thu Apr 14 04:08:10 2005 +0000
+++ b/src/gtkconv.c	Fri Apr 15 00:28:54 2005 +0000
@@ -2250,8 +2250,8 @@
 			dest_win = gaim_conv_window_new();
 
 			gaim_conv_window_add_conversation(dest_win,
-					gaim_conv_window_remove_conversation(win,
-							gaim_conversation_get_index(conv)));
+			                                  gaim_conv_window_remove_conversation(win,
+			                                  conv));
 
 			dest_gtkwin = GAIM_GTK_WINDOW(dest_win);
 
@@ -2281,8 +2281,7 @@
 		else {
 			size_t pos;
 
-			gaim_conv_window_remove_conversation(win,
-				gaim_conversation_get_index(conv));
+			gaim_conv_window_remove_conversation(win, conv);
 
 			pos = gaim_conv_window_add_conversation(dest_win, conv);
 
@@ -4119,9 +4118,8 @@
 		if (c != NULL) {
 			GaimConvWindow *oldwin;
 			oldwin = gaim_conversation_get_window(c);
-			index = gaim_conversation_get_index(c);
 			if (oldwin != win) {
-				gaim_conv_window_remove_conversation(oldwin, index);
+				gaim_conv_window_remove_conversation(oldwin, c);
 				gaim_conv_window_add_conversation(win, c);
 			}
 		} else {