Mercurial > pidgin.yaz
comparison pidgin/gtkconv.c @ 17141:03866cefa848
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!
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Fri, 18 May 2007 01:03:53 +0000 |
parents | 80350acaa289 |
children | 97a98ceb5c06 |
comparison
equal
deleted
inserted
replaced
17140:3c4280387259 | 17141:03866cefa848 |
---|---|
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 { |