diff plugins/gestures/gestures.c @ 10842:de9af04c50ff

[gaim-migrate @ 12514] sf patch #1185433, from Richard Laager "The gestures plugin started giving me compiler warnings. I tracked them down and rewrote the appropriate section of code. Tested and found to work." committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Tue, 19 Apr 2005 03:29:40 +0000
parents 8d52201620d0
children 50224ac8184d
line wrap: on
line diff
--- a/plugins/gestures/gestures.c	Tue Apr 19 03:18:50 2005 +0000
+++ b/plugins/gestures/gestures.c	Tue Apr 19 03:29:40 2005 +0000
@@ -57,18 +57,28 @@
 {
 	GaimConversation *conv;
 	GaimConvWindow *win;
-	unsigned int index;
+	GList *conversations;
 
 	conv  = (GaimConversation *)data;
 	win   = gaim_conversation_get_window(conv);
-	index = gaim_conversation_get_index(conv);
 
-	if (index == 0)
-		index = gaim_conv_window_get_conversation_count(win) - 1;
-	else
-		index--;
+	for (conversations = gaim_conv_window_get_conversations(win);
+			conversations != NULL;
+			conversations = conversations->next)
+	{
+		if (conversations->data == conv)
+		{
+			if (conversations->prev != NULL) {
+				gaim_conv_window_switch_conversation(win,
+						conversations->prev->data);
+			} else {
+				gaim_conv_window_switch_conversation(win,
+						g_list_last(conversations)->data);
+			}
 
-	gaim_conv_window_switch_conversation(win, index);
+			return;
+		}
+	}
 }
 
 static void
@@ -76,18 +86,28 @@
 {
 	GaimConversation *conv;
 	GaimConvWindow *win;
-	unsigned int index;
+	GList *conversations;
 
 	conv  = (GaimConversation *)data;
 	win   = gaim_conversation_get_window(conv);
-	index = gaim_conversation_get_index(conv);
 
-	if (index == gaim_conv_window_get_conversation_count(win) - 1)
-		index = 0;
-	else
-		index++;
+	for (conversations = gaim_conv_window_get_conversations(win);
+			conversations != NULL;
+			conversations = conversations->next)
+	{
+		if (conversations->data == conv)
+		{
+			if (conversations->next != NULL) {
+				gaim_conv_window_switch_conversation(win,
+						conversations->next->data);
+			} else {
+				gaim_conv_window_switch_conversation(win,
+						g_list_first(conversations)->data);
+			}
 
-	gaim_conv_window_switch_conversation(win, index);
+			return;
+		}
+	}
 }
 
 void