comparison src/gtkconv.c @ 10893:3f85d6fc763a

[gaim-migrate @ 12606] Will (resiak) Thompson fixed control-tab committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Mon, 02 May 2005 17:49:37 +0000
parents 175167f62c28
children e0cf11160c97
comparison
equal deleted inserted replaced
10892:175167f62c28 10893:3f85d6fc763a
1589 move_to_next_unread_tab(GaimGtkConversation *gtkconv) 1589 move_to_next_unread_tab(GaimGtkConversation *gtkconv)
1590 { 1590 {
1591 GaimGtkConversation *next_gtkconv = NULL; 1591 GaimGtkConversation *next_gtkconv = NULL;
1592 GaimConvWindow *win; 1592 GaimConvWindow *win;
1593 GList *l; 1593 GList *l;
1594 int index, i; 1594 int index, i, found = 0;
1595 1595
1596 win = gaim_conversation_get_window(gtkconv->active_conv); 1596 win = gaim_conversation_get_window(gtkconv->active_conv);
1597 index = gtk_notebook_page_num(GTK_NOTEBOOK(GAIM_GTK_WINDOW(win)->notebook), gtkconv->tab_cont); 1597 index = gtk_notebook_page_num(GTK_NOTEBOOK(GAIM_GTK_WINDOW(win)->notebook), gtkconv->tab_cont);
1598 1598
1599 /* First check the tabs after this position. */ 1599 /* First check the tabs after this position. */
1600 for (i = index; (next_gtkconv = gaim_gtk_get_gtkconv_at_index(win, i)); i++) { 1600 for (i = index; !found && (next_gtkconv = gaim_gtk_get_gtkconv_at_index(win, i)); i++) {
1601 for (l = next_gtkconv->convs; l; l = l->next) { 1601 for (l = next_gtkconv->convs; l; l = l->next) {
1602 GaimConversation *c = l->data; 1602 GaimConversation *c = l->data;
1603 if (gaim_conversation_get_unseen(c) > 0) 1603 if (gaim_conversation_get_unseen(c) > 0)
1604 {
1605 found = 1;
1604 break; 1606 break;
1605 } 1607 }
1606 } 1608 }
1607 1609 }
1608 if (next_gtkconv == NULL) { 1610
1609 1611 if (!found) {
1610 /* Now check before this position. */ 1612 /* Now check from the beginning up to this position. */
1611 for (i = index; i >= 0 && (next_gtkconv = gaim_gtk_get_gtkconv_at_index(win, i)); i--) { 1613 for (i = 0; !found && i < index && (next_gtkconv = gaim_gtk_get_gtkconv_at_index(win, i)); i++) {
1612 for (l = next_gtkconv->convs; l; l = l->next) { 1614 for (l = next_gtkconv->convs; l; l = l->next) {
1613 GaimConversation *c = l->data; 1615 GaimConversation *c = l->data;
1614 if (gaim_conversation_get_unseen(c) > 0) 1616 if (gaim_conversation_get_unseen(c) > 0) {
1617 found = 1;
1615 break; 1618 break;
1619 }
1616 } 1620 }
1617 } 1621 }
1618 1622
1619 if (next_gtkconv == NULL) { 1623 if (!found) {
1620 /* Okay, just grab the next conversation tab. */ 1624 /* Okay, just grab the next conversation tab. */
1621 if (!(next_gtkconv = gaim_gtk_get_gtkconv_at_index(win, index + 1))) 1625 if (!(next_gtkconv = gaim_gtk_get_gtkconv_at_index(win, index + 1)))
1622 next_gtkconv = gaim_gtk_get_gtkconv_at_index(win, index - 1); 1626 next_gtkconv = gaim_gtk_get_gtkconv_at_index(win, 0);
1623 1627
1624 } 1628 }
1625 } 1629 }
1626 1630
1627 if (next_gtkconv != NULL && next_gtkconv != gtkconv) 1631 if (next_gtkconv != NULL && next_gtkconv != gtkconv)