# HG changeset patch # User Sadrul Habib Chowdhury # Date 1179450233 0 # Node ID 03866cefa8489b9834a1a1c01308537500a12879 # Parent 3c42803872598127fade949f4e1b28ec3eb70963 Patch #1054 from resiak. "Make Ctrl-[Shift-]Tab prefer tabs with higher-valued unseen_states to those which are nearer but have lower values. This has the effect of making Ctrl-Tab ignore conversations with activity like status changes when other tabs have unread messages, and prefer chats where you are hilighted even more. (By an amazing coincidence, this is exactly what meta-a does in irssi.)". This closes #1054. resiak: Thanks! diff -r 3c4280387259 -r 03866cefa848 pidgin/gtkconv.c --- a/pidgin/gtkconv.c Thu May 17 22:04:49 2007 +0000 +++ b/pidgin/gtkconv.c Fri May 18 01:03:53 2007 +0000 @@ -1755,7 +1755,8 @@ static void move_to_next_unread_tab(PidginConversation *gtkconv, gboolean forward) { - PidginConversation *next_gtkconv = NULL; + PidginConversation *next_gtkconv = NULL, *most_active = NULL; + PidginUnseenState unseen_state = PIDGIN_UNSEEN_NONE; PidginWindow *win; int initial, i, total, diff; @@ -1771,17 +1772,21 @@ for (i = (initial + diff) % total; i != initial; i = (i + diff) % total) { next_gtkconv = pidgin_conv_window_get_gtkconv_at_index(win, i); - if (next_gtkconv->unseen_state > 0) - break; - } - - if (i == initial) { /* no new messages */ + if (next_gtkconv->unseen_state > unseen_state) { + most_active = next_gtkconv; + unseen_state = most_active->unseen_state; + if(PIDGIN_UNSEEN_NICK == unseen_state) /* highest possible state */ + break; + } + } + + if (most_active == NULL) { /* no new messages */ i = (i + diff) % total; - next_gtkconv = pidgin_conv_window_get_gtkconv_at_index(win, i); - } - - if (next_gtkconv != NULL && next_gtkconv != gtkconv) - pidgin_conv_window_switch_gtkconv(win, next_gtkconv); + most_active = pidgin_conv_window_get_gtkconv_at_index(win, i); + } + + if (most_active != NULL && most_active != gtkconv) + pidgin_conv_window_switch_gtkconv(win, most_active); } static gboolean