summaryrefslogtreecommitdiff
path: root/src/gui/gui-bar-item.c
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2011-04-11 13:57:00 +0200
committerSebastien Helleu <flashcode@flashtux.org>2011-04-11 13:57:00 +0200
commit9d128cad2279ff070d8204e1d3d7003f379c58da (patch)
treef75686cf81ed32debf23d13809dd90c7f0b0cb4d /src/gui/gui-bar-item.c
parent8597f14bf6efe06000070c0e90fe729c843e8d7c (diff)
downloadweechat-9d128cad2279ff070d8204e1d3d7003f379c58da.zip
core: add messages counts in hotlist for each buffer, option weechat.look.hotlist_buffer_separator and tag "notify_none"
New options: - weechat.look.hotlist_buffer_separator - weechat.look.hotlist_count_max - weechat.look.hotlist_count_min_msg - weechat.color.status_count_msg - weechat.color.status_count_private - weechat.color.status_count_highlight - weechat.color.status_count_other
Diffstat (limited to 'src/gui/gui-bar-item.c')
-rw-r--r--src/gui/gui-bar-item.c79
1 files changed, 77 insertions, 2 deletions
diff --git a/src/gui/gui-bar-item.c b/src/gui/gui-bar-item.c
index e3c589872..148be7724 100644
--- a/src/gui/gui-bar-item.c
+++ b/src/gui/gui-bar-item.c
@@ -1034,6 +1034,7 @@ gui_bar_item_default_hotlist (void *data, struct t_gui_bar_item *item,
char buf[2048], format[32], *buffer_without_name_displayed;
struct t_gui_hotlist *ptr_hotlist;
int numbers_count, names_count, display_name;
+ int priority, priority_min, priority_min_displayed, private;
/* make C compiler happy */
(void) data;
@@ -1045,6 +1046,7 @@ gui_bar_item_default_hotlist (void *data, struct t_gui_bar_item *item,
buf[0] = '\0';
+ /* TRANSLATORS: if possible use short word or abbreviation here ("Act" is abbreviation of "Activity" in english) */
strcat (buf, _("Act: "));
buffer_without_name_displayed = NULL;
@@ -1088,10 +1090,12 @@ gui_bar_item_default_hotlist (void *data, struct t_gui_bar_item *item,
if (display_name || !buffer_without_name_displayed
|| (buffer_without_name_displayed[ptr_hotlist->buffer->number - 1] == 0))
{
- if (numbers_count > 0)
+ if ((numbers_count > 0)
+ && (CONFIG_STRING(config_look_hotlist_buffer_separator))
+ && (CONFIG_STRING(config_look_hotlist_buffer_separator)[0]))
{
strcat (buf, GUI_COLOR_CUSTOM_BAR_DELIM);
- strcat (buf, ",");
+ strcat (buf, CONFIG_STRING(config_look_hotlist_buffer_separator));
}
switch (ptr_hotlist->priority)
@@ -1108,6 +1112,12 @@ gui_bar_item_default_hotlist (void *data, struct t_gui_bar_item *item,
case GUI_HOTLIST_HIGHLIGHT:
strcat (buf, gui_color_get_custom (gui_color_get_name (CONFIG_COLOR(config_color_status_data_highlight))));
break;
+ case GUI_HOTLIST_NUM_PRIORITIES:
+ /*
+ * this constant is used to count hotlist priorities only,
+ * it is never used as priority
+ */
+ break;
}
sprintf (buf + strlen (buf), "%d", ptr_hotlist->buffer->number);
numbers_count++;
@@ -1135,6 +1145,71 @@ gui_bar_item_default_hotlist (void *data, struct t_gui_bar_item *item,
buffer_without_name_displayed[ptr_hotlist->buffer->number - 1] = 1;
}
+ /* display messages count by priority */
+ if (CONFIG_INTEGER(config_look_hotlist_count_max) > 0)
+ {
+ private = (ptr_hotlist->count[GUI_HOTLIST_PRIVATE] > 0) ? 1 : 0;
+ priority_min_displayed = ptr_hotlist->priority + 1;
+ priority_min = ptr_hotlist->priority - CONFIG_INTEGER(config_look_hotlist_count_max);
+ if (priority_min < 0)
+ priority_min = 0;
+ for (priority = ptr_hotlist->priority;
+ priority >= priority_min;
+ priority--)
+ {
+ if (!private && (priority == GUI_HOTLIST_PRIVATE))
+ continue;
+ if (private && (priority == GUI_HOTLIST_MESSAGE))
+ continue;
+ if (((priority == (int)ptr_hotlist->priority)
+ && (ptr_hotlist->count[priority] >= CONFIG_INTEGER(config_look_hotlist_count_min_msg)))
+ || ((priority != (int)ptr_hotlist->priority)
+ && (ptr_hotlist->count[priority] > 0)))
+ {
+ priority_min_displayed = priority;
+ }
+ }
+ if (priority_min_displayed <= (int)ptr_hotlist->priority)
+ {
+ for (priority = ptr_hotlist->priority;
+ priority >= priority_min_displayed;
+ priority--)
+ {
+ if (!private && (priority == GUI_HOTLIST_PRIVATE))
+ continue;
+ if (private && (priority == GUI_HOTLIST_MESSAGE))
+ continue;
+ strcat (buf, GUI_COLOR_CUSTOM_BAR_DELIM);
+ strcat (buf, (priority == (int)ptr_hotlist->priority) ? "(" : ",");
+ switch (priority)
+ {
+ case GUI_HOTLIST_LOW:
+ strcat (buf, gui_color_get_custom (gui_color_get_name (CONFIG_COLOR(config_color_status_count_other))));
+ break;
+ case GUI_HOTLIST_MESSAGE:
+ strcat (buf, gui_color_get_custom (gui_color_get_name (CONFIG_COLOR(config_color_status_count_msg))));
+ break;
+ case GUI_HOTLIST_PRIVATE:
+ strcat (buf, gui_color_get_custom (gui_color_get_name (CONFIG_COLOR(config_color_status_count_private))));
+ break;
+ case GUI_HOTLIST_HIGHLIGHT:
+ strcat (buf, gui_color_get_custom (gui_color_get_name (CONFIG_COLOR(config_color_status_count_highlight))));
+ break;
+ case GUI_HOTLIST_NUM_PRIORITIES:
+ /*
+ * this constant is used to count hotlist priorities only,
+ * it is never used as priority
+ */
+ break;
+ }
+ sprintf (buf + strlen (buf),
+ "%d", ptr_hotlist->count[priority]);
+ }
+ strcat (buf, GUI_COLOR_CUSTOM_BAR_DELIM);
+ strcat (buf, ")");
+ }
+ }
+
if (strlen (buf) > sizeof (buf) - 64)
break;
}