diff options
author | Emanuele Giaquinta <exg@irssi.org> | 2008-05-15 10:54:03 +0000 |
---|---|---|
committer | exg <exg@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2008-05-15 10:54:03 +0000 |
commit | aa002fa78ca6c36036499c2f59830bf5ae9038b1 (patch) | |
tree | a3eb3ff63d009e66735574786cfefa220f52f481 /src/fe-text/statusbar-items.c | |
parent | f71679ca696d1d08364cb4374e4d3802b3123e98 (diff) | |
download | irssi-aa002fa78ca6c36036499c2f59830bf5ae9038b1.zip |
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
Diffstat (limited to 'src/fe-text/statusbar-items.c')
-rw-r--r-- | src/fe-text/statusbar-items.c | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/src/fe-text/statusbar-items.c b/src/fe-text/statusbar-items.c index fd10c315..e58781ef 100644 --- a/src/fe-text/statusbar-items.c +++ b/src/fe-text/statusbar-items.c @@ -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; |