1
0
mirror of https://github.com/irssi/irssi.git synced 2024-10-27 05:20:20 -04:00

Activity list colors are now configurable.

git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1903 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2001-10-23 21:26:03 +00:00 committed by cras
parent 3f3ea3c1b5
commit 7793f2fe73
2 changed files with 47 additions and 13 deletions

View File

@ -262,10 +262,23 @@ abstracts = {
# used for anything.
sbend = " ";
prompt = "[$*] ";
sb = " %c[%n$*%c]%n";
sbmode = "(%c+%n$*)";
sbaway = " (%GzZzZ%n)";
sbservertag = ":$0 (change with ^X)";
prompt = "[$*] ";
# activity in statusbar
# ',' separator
sb_act_sep = "%c$*";
# normal text
sb_act_text = "%c$*";
# public message
sb_act_msg = "%W$*";
# hilight
sb_act_hilight = "%M$*";
# hilight with specified color, $0 = color, $1 = text
sb_act_hilight_color = "$0$1-%n";
};

View File

@ -22,6 +22,7 @@
#include "signals.h"
#include "settings.h"
#include "themes.h"
#include "statusbar.h"
#include "gui-entry.h"
@ -118,15 +119,20 @@ static void item_lag(SBAR_ITEM_REC *item, int get_size_only)
g_string_free(str, TRUE);
}
static char *get_activity_list(int normal, int hilight)
static char *get_activity_list(MAIN_WINDOW_REC *window, int normal, int hilight)
{
THEME_REC *theme;
GString *str;
GList *tmp;
char *ret;
char *ret, *name, *format, *value;
int is_det;
str = g_string_new(NULL);
theme = window != NULL && window->active != NULL &&
window->active->theme != NULL ?
window->active->theme : current_theme;
for (tmp = activity_list; tmp != NULL; tmp = tmp->next) {
WINDOW_REC *window = tmp->data;
@ -134,26 +140,41 @@ static char *get_activity_list(int normal, int hilight)
if ((!is_det && !normal) || (is_det && !hilight))
continue;
g_string_append(str, "%c");
if (str->len > 2)
g_string_append_c(str, ',');
/* comma separator */
if (str->len > 0) {
value = theme_format_expand(theme, "{sb_act_sep ,}");
g_string_append(str, value);
g_free(value);
}
switch (window->data_level) {
case DATA_LEVEL_NONE:
case DATA_LEVEL_TEXT:
name = "{sb_act_text %d}";
break;
case DATA_LEVEL_MSG:
g_string_append(str, "%W");
name = "{sb_act_msg %d}";
break;
default:
g_string_append(str, window->hilight_color == NULL ?
"%M" : window->hilight_color);
if (window->hilight_color == NULL)
name = "{sb_act_hilight %d}";
else
name = NULL;
break;
}
g_string_sprintfa(str, "%d", window->refnum);
/* make sure the background is returned to default */
g_string_append(str, "%n");
if (name != NULL)
format = g_strdup_printf(name, window->refnum);
else
format = g_strdup_printf("{sb_act_hilight_color %s %d}",
window->hilight_color,
window->refnum);
value = theme_format_expand(theme, format);
g_string_append(str, value);
g_free(value);
g_free(format);
}
ret = str->len == 0 ? NULL : str->str;
@ -168,7 +189,7 @@ static void item_act(SBAR_ITEM_REC *item, int get_size_only)
{
char *actlist;
actlist = get_activity_list(TRUE, TRUE);
actlist = get_activity_list(item->bar->parent_window, TRUE, TRUE);
if (actlist == NULL) {
if (get_size_only)
item->min_size = item->max_size = 0;