# HG changeset patch # User Luke Schierer # Date 1115056177 0 # Node ID 3f85d6fc763a920268b65ce943d5c9c1c17e2279 # Parent 175167f62c28d1c63b623bea012833c5f3e5775a [gaim-migrate @ 12606] Will (resiak) Thompson fixed control-tab committer: Tailor Script diff -r 175167f62c28 -r 3f85d6fc763a src/gtkconv.c --- a/src/gtkconv.c Sun May 01 14:00:37 2005 +0000 +++ b/src/gtkconv.c Mon May 02 17:49:37 2005 +0000 @@ -1591,35 +1591,39 @@ GaimGtkConversation *next_gtkconv = NULL; GaimConvWindow *win; GList *l; - int index, i; + int index, i, found = 0; win = gaim_conversation_get_window(gtkconv->active_conv); index = gtk_notebook_page_num(GTK_NOTEBOOK(GAIM_GTK_WINDOW(win)->notebook), gtkconv->tab_cont); /* First check the tabs after this position. */ - for (i = index; (next_gtkconv = gaim_gtk_get_gtkconv_at_index(win, i)); i++) { + for (i = index; !found && (next_gtkconv = gaim_gtk_get_gtkconv_at_index(win, i)); i++) { for (l = next_gtkconv->convs; l; l = l->next) { GaimConversation *c = l->data; if (gaim_conversation_get_unseen(c) > 0) + { + found = 1; break; + } } } - - if (next_gtkconv == NULL) { - - /* Now check before this position. */ - for (i = index; i >= 0 && (next_gtkconv = gaim_gtk_get_gtkconv_at_index(win, i)); i--) { + + if (!found) { + /* Now check from the beginning up to this position. */ + for (i = 0; !found && i < index && (next_gtkconv = gaim_gtk_get_gtkconv_at_index(win, i)); i++) { for (l = next_gtkconv->convs; l; l = l->next) { GaimConversation *c = l->data; - if (gaim_conversation_get_unseen(c) > 0) + if (gaim_conversation_get_unseen(c) > 0) { + found = 1; break; + } } } - if (next_gtkconv == NULL) { + if (!found) { /* Okay, just grab the next conversation tab. */ if (!(next_gtkconv = gaim_gtk_get_gtkconv_at_index(win, index + 1))) - next_gtkconv = gaim_gtk_get_gtkconv_at_index(win, index - 1); + next_gtkconv = gaim_gtk_get_gtkconv_at_index(win, 0); } }