1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-09 19:23:13 +02:00

core: add bar item "lag"

This bar item is overridden by the irc bar item with the same name, but it used
on relay remote buffers, so that the lag is visible as well.
This commit is contained in:
Sébastien Helleu
2024-05-16 07:58:52 +02:00
parent 47f40f961a
commit 5c79933faa
3 changed files with 43 additions and 2 deletions
+1
View File
@@ -15,6 +15,7 @@ For a list of important changes that require manual actions, please look at rele
New features:: New features::
* core: add bar item "lag"
* core: add buffer properties "input_prompt" and "modes" * core: add buffer properties "input_prompt" and "modes"
* core: send signal "buffer_line_added" on buffers with free content * core: send signal "buffer_line_added" on buffers with free content
* core: add support of XDG "state" directory (issue #2106, issue #1747) * core: add support of XDG "state" directory (issue #2106, issue #1747)
+41 -2
View File
@@ -66,8 +66,8 @@ char *gui_bar_item_names[GUI_BAR_NUM_ITEMS] =
"buffer_name", "buffer_short_name", "buffer_modes", "buffer_filter", "buffer_name", "buffer_short_name", "buffer_modes", "buffer_filter",
"buffer_zoom", "buffer_nicklist_count", "buffer_nicklist_count_groups", "buffer_zoom", "buffer_nicklist_count", "buffer_nicklist_count_groups",
"buffer_nicklist_count_all", "scroll", "hotlist", "completion", "buffer_nicklist_count_all", "scroll", "hotlist", "completion",
"buffer_title", "buffer_nicklist", "window_number", "mouse_status", "away", "buffer_title", "buffer_nicklist", "window_number", "mouse_status", "lag",
"spacer" "away", "spacer"
}; };
struct t_gui_bar_item_hook *gui_bar_item_hooks = NULL; struct t_gui_bar_item_hook *gui_bar_item_hooks = NULL;
struct t_hook *gui_bar_item_timer = NULL; struct t_hook *gui_bar_item_timer = NULL;
@@ -2042,6 +2042,38 @@ gui_bar_item_mouse_status_cb (const void *pointer, void *data,
return strdup (str_mouse); return strdup (str_mouse);
} }
/*
* Bar item with buffer lag.
*/
char *
gui_bar_item_lag_cb (const void *pointer, void *data,
struct t_gui_bar_item *item,
struct t_gui_window *window,
struct t_gui_buffer *buffer,
struct t_hashtable *extra_info)
{
const char *lag;
char str_lag[1024];
/* make C compiler happy */
(void) pointer;
(void) data;
(void) item;
(void) window;
(void) extra_info;
if (!buffer)
return NULL;
lag = (const char *)hashtable_get (buffer->local_variables, "lag");
if (!lag)
return NULL;
snprintf (str_lag, sizeof (str_lag), "%s: %s", _("Lag"), lag);
return strdup (str_lag);
}
/* /*
* Bar item with away message. * Bar item with away message.
*/ */
@@ -2489,6 +2521,13 @@ gui_bar_item_init ()
gui_bar_item_hook_signal ("mouse_enabled;mouse_disabled", gui_bar_item_hook_signal ("mouse_enabled;mouse_disabled",
gui_bar_item_names[GUI_BAR_ITEM_MOUSE_STATUS]); gui_bar_item_names[GUI_BAR_ITEM_MOUSE_STATUS]);
/* lag */
gui_bar_item_new (NULL,
gui_bar_item_names[GUI_BAR_ITEM_LAG],
&gui_bar_item_lag_cb, NULL, NULL);
gui_bar_item_hook_signal ("window_switch;buffer_switch;buffer_localvar_*",
gui_bar_item_names[GUI_BAR_ITEM_LAG]);
/* away message */ /* away message */
gui_bar_item_new (NULL, gui_bar_item_new (NULL,
gui_bar_item_names[GUI_BAR_ITEM_AWAY], gui_bar_item_names[GUI_BAR_ITEM_AWAY],
+1
View File
@@ -46,6 +46,7 @@ enum t_gui_bar_item_weechat
GUI_BAR_ITEM_BUFFER_NICKLIST, GUI_BAR_ITEM_BUFFER_NICKLIST,
GUI_BAR_ITEM_WINDOW_NUMBER, GUI_BAR_ITEM_WINDOW_NUMBER,
GUI_BAR_ITEM_MOUSE_STATUS, GUI_BAR_ITEM_MOUSE_STATUS,
GUI_BAR_ITEM_LAG,
GUI_BAR_ITEM_AWAY, GUI_BAR_ITEM_AWAY,
GUI_BAR_ITEM_SPACER, GUI_BAR_ITEM_SPACER,
/* number of bar items */ /* number of bar items */