pidgin/gtkconv.c

changeset 17219
15256be9cf8b
parent 17218
2353730dae7f
parent 17185
aee12ae11898
equal deleted inserted replaced
17218:2353730dae7f 17219:15256be9cf8b
1753 } 1753 }
1754 1754
1755 static void 1755 static void
1756 move_to_next_unread_tab(PidginConversation *gtkconv, gboolean forward) 1756 move_to_next_unread_tab(PidginConversation *gtkconv, gboolean forward)
1757 { 1757 {
1758 PidginConversation *next_gtkconv = NULL; 1758 PidginConversation *next_gtkconv = NULL, *most_active = NULL;
1759 PidginUnseenState unseen_state = PIDGIN_UNSEEN_NONE;
1759 PidginWindow *win; 1760 PidginWindow *win;
1760 int initial, i, total, diff; 1761 int initial, i, total, diff;
1761 1762
1762 win = gtkconv->win; 1763 win = gtkconv->win;
1763 initial = gtk_notebook_page_num(GTK_NOTEBOOK(win->notebook), 1764 initial = gtk_notebook_page_num(GTK_NOTEBOOK(win->notebook),
1769 */ 1770 */
1770 diff = (forward ? 1 : -1) + total; 1771 diff = (forward ? 1 : -1) + total;
1771 1772
1772 for (i = (initial + diff) % total; i != initial; i = (i + diff) % total) { 1773 for (i = (initial + diff) % total; i != initial; i = (i + diff) % total) {
1773 next_gtkconv = pidgin_conv_window_get_gtkconv_at_index(win, i); 1774 next_gtkconv = pidgin_conv_window_get_gtkconv_at_index(win, i);
1774 if (next_gtkconv->unseen_state > 0) 1775 if (next_gtkconv->unseen_state > unseen_state) {
1775 break; 1776 most_active = next_gtkconv;
1776 } 1777 unseen_state = most_active->unseen_state;
1777 1778 if(PIDGIN_UNSEEN_NICK == unseen_state) /* highest possible state */
1778 if (i == initial) { /* no new messages */ 1779 break;
1780 }
1781 }
1782
1783 if (most_active == NULL) { /* no new messages */
1779 i = (i + diff) % total; 1784 i = (i + diff) % total;
1780 next_gtkconv = pidgin_conv_window_get_gtkconv_at_index(win, i); 1785 most_active = pidgin_conv_window_get_gtkconv_at_index(win, i);
1781 } 1786 }
1782 1787
1783 if (next_gtkconv != NULL && next_gtkconv != gtkconv) 1788 if (most_active != NULL && most_active != gtkconv)
1784 pidgin_conv_window_switch_gtkconv(win, next_gtkconv); 1789 pidgin_conv_window_switch_gtkconv(win, most_active);
1785 } 1790 }
1786 1791
1787 static gboolean 1792 static gboolean
1788 entry_key_press_cb(GtkWidget *entry, GdkEventKey *event, gpointer data) 1793 entry_key_press_cb(GtkWidget *entry, GdkEventKey *event, gpointer data)
1789 { 1794 {

mercurial