1
0
mirror of https://github.com/irssi/irssi.git synced 2024-07-14 03:04:17 -04:00

Re-add sort by level / aux-sort by refnum and re-map actlist_sort

'level' value to it. Add 'level,recent' value for sort by level /
aux-sort by most recent activity. Requested by tomaw.


git-svn-id: http://svn.irssi.org/repos/irssi/trunk@4824 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Emanuele Giaquinta 2008-05-15 10:54:03 +00:00 committed by exg
parent f71679ca69
commit aa002fa78c

View File

@ -152,7 +152,7 @@ static void item_act(SBAR_ITEM_REC *item, int get_size_only)
g_free_not_null(actlist);
}
static int window_level_cmp(WINDOW_REC *w1, WINDOW_REC *w2)
static int window_level_recent_cmp(WINDOW_REC *w1, WINDOW_REC *w2)
{
if (w1->data_level >= w2->data_level)
return -1;
@ -160,6 +160,15 @@ static int window_level_cmp(WINDOW_REC *w1, WINDOW_REC *w2)
return 1;
}
static int window_level_cmp(WINDOW_REC *w1, WINDOW_REC *w2)
{
if (w1->data_level > w2->data_level ||
(w1->data_level == w2->data_level && w1->refnum < w2->refnum))
return -1;
else
return 1;
}
static void sig_statusbar_activity_hilight(WINDOW_REC *window, gpointer oldlevel)
{
GList *node;
@ -180,6 +189,11 @@ static void sig_statusbar_activity_hilight(WINDOW_REC *window, gpointer oldlevel
if (actlist_sort == 2) {
if (node != NULL) {
if (window->data_level == GPOINTER_TO_INT(oldlevel)) {
if (window->hilight_color != 0)
statusbar_items_redraw("act");
return;
}
activity_list = g_list_delete_link(activity_list, node);
}
if (window->data_level != 0)
@ -189,6 +203,16 @@ static void sig_statusbar_activity_hilight(WINDOW_REC *window, gpointer oldlevel
return;
}
if (actlist_sort == 3) {
if (node != NULL)
activity_list = g_list_delete_link(activity_list, node);
if (window->data_level != 0)
activity_list = g_list_insert_sorted(activity_list, window, (GCompareFunc)
window_level_recent_cmp);
statusbar_items_redraw("act");
return;
}
if (node != NULL) {
/* already in activity list */
if (window->data_level == 0) {
@ -393,6 +417,8 @@ static void read_settings(void)
actlist_sort = 1;
else if (g_ascii_strcasecmp(str, "level") == 0)
actlist_sort = 2;
else if (g_ascii_strcasecmp(str, "level,recent") == 0)
actlist_sort = 3;
else {
settings_set_str("actlist_sort", "refnum");
actlist_sort = 0;