1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-29 14:26:39 +02:00

Added conditions for bar display and bar max size

This commit is contained in:
Sebastien Helleu
2008-04-22 18:11:33 +02:00
parent 9d49beabf1
commit 06fd80e210
25 changed files with 695 additions and 296 deletions
+56 -16
View File
@@ -66,7 +66,7 @@ command_bar (void *data, struct t_gui_buffer *buffer,
{
int type, position;
long number;
char *error;
char *error, *str_type, *pos_condition;
struct t_gui_bar *ptr_bar;
struct t_gui_bar_item *ptr_item;
@@ -86,10 +86,14 @@ command_bar (void *data, struct t_gui_buffer *buffer,
ptr_bar = ptr_bar->next_bar)
{
gui_chat_printf (NULL,
_(" %d. %s: %s, %s, %s: %s%s%d%s, items: %s%s (plugin: %s)"),
_(" %d. %s: %s (cond: %s), %s, %s: "
"%s%s%d%s, items: %s%s (plugin: %s)"),
ptr_bar->number,
ptr_bar->name,
gui_bar_type_str[CONFIG_INTEGER(ptr_bar->type)],
(CONFIG_STRING(ptr_bar->conditions)
&& CONFIG_STRING(ptr_bar->conditions)[0]) ?
CONFIG_STRING(ptr_bar->conditions) : "-",
gui_bar_position_str[CONFIG_INTEGER(ptr_bar->position)],
((CONFIG_INTEGER(ptr_bar->position) == GUI_BAR_POSITION_BOTTOM)
|| (CONFIG_INTEGER(ptr_bar->position) == GUI_BAR_POSITION_TOP)) ?
@@ -145,14 +149,32 @@ command_bar (void *data, struct t_gui_buffer *buffer,
"bar");
return WEECHAT_RC_ERROR;
}
type = gui_bar_search_type (argv[3]);
pos_condition = strchr (argv[3], ',');
if (pos_condition)
{
str_type = string_strndup (argv[3], pos_condition - argv[3]);
pos_condition++;
}
else
{
str_type = strdup (argv[3]);
}
if (!str_type)
{
gui_chat_printf (NULL,
_("%sNot enough memory"),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR]);
return WEECHAT_RC_ERROR;
}
type = gui_bar_search_type (str_type);
if (type < 0)
{
gui_chat_printf (NULL,
_("%sError: wrong type \"%s\" for bar "
"\"%s\""),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
argv[3], argv[2]);
str_type, argv[2]);
free (str_type);
return WEECHAT_RC_ERROR;
}
position = gui_bar_search_position (argv[4]);
@@ -163,6 +185,7 @@ command_bar (void *data, struct t_gui_buffer *buffer,
"\"%s\""),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
argv[4], argv[2]);
free (str_type);
return WEECHAT_RC_ERROR;
}
error = NULL;
@@ -170,8 +193,8 @@ command_bar (void *data, struct t_gui_buffer *buffer,
if (error && !error[0])
{
/* create bar */
if (gui_bar_new (NULL, argv[2], argv[3], argv[4], argv[5],
argv[6], argv_eol[7]))
if (gui_bar_new (NULL, argv[2], str_type, pos_condition, argv[4],
argv[5], "0", argv[6], argv_eol[7]))
{
gui_chat_printf (NULL, _("Bar \"%s\" created"),
argv[2]);
@@ -191,8 +214,10 @@ command_bar (void *data, struct t_gui_buffer *buffer,
"\"%s\""),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
argv[5], argv[2]);
free (str_type);
return WEECHAT_RC_ERROR;
}
free (str_type);
return WEECHAT_RC_OK;
}
@@ -245,7 +270,15 @@ command_bar (void *data, struct t_gui_buffer *buffer,
argv[2]);
return WEECHAT_RC_ERROR;
}
gui_bar_set (ptr_bar, argv[3], argv_eol[4]);
if (!gui_bar_set (ptr_bar, argv[3], argv_eol[4]))
{
gui_chat_printf (NULL,
_("%sError: unable to set option \"%s\" for "
"bar \"%s\""),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
argv[3], argv[2]);
return WEECHAT_RC_ERROR;
}
return WEECHAT_RC_OK;
}
@@ -2331,7 +2364,7 @@ command_window (void *data, struct t_gui_buffer *buffer,
/* refresh screen */
if (string_strcasecmp (argv[1], "refresh") == 0)
{
gui_window_refresh_screen (1);
gui_window_refresh_needed = 1;
return WEECHAT_RC_OK;
}
@@ -2461,14 +2494,21 @@ command_init ()
{
hook_command (NULL, "bar",
N_("manage bars"),
N_("[add barname type position size separator item1,item2,...] "
"| [del barname] | [set barname name|number|position|"
"size|separator|items value] | [list] | [listitems]"),
N_("[add barname type[,cond1,cond2,...] position size "
"separator item1,item2,...] | [del barname] | "
"[set barname name|number|condition|position|size|"
"separator|items value] | [list] | [listitems]"),
N_(" add: add a new bar\n"
" barname: name of bar (must be unique)\n"
" type: \"root\" (outside windows), \"window_active\" "
"(inside active window), or \"window_inactive\" (inside "
"each inactive window)\n"
" type: root: outside windows),\n"
" window: inside windows, with optional "
"conditions (see below)\n"
"cond1,...: condition(s) for displaying bar (only for "
"type \"window\"):\n"
" active: on active window\n"
" inactive: on inactive windows\n"
" nicklist: on windows with nicklist\n"
" without condition, bar is always displayed\n"
" position: bottom, top, left or right\n"
" size: size of bar (in chars)\n"
"separator: 1 for using separator (line), 0 or nothing "
@@ -2478,8 +2518,8 @@ command_init ()
" set: set a value for a bar property\n"
" list: list all bars\n"
"listitems: list all bar items"),
"add|del|set|list|listitems %r name|number|position|size|"
"separator|items",
"add|del|set|list|listitems %r name|number|conditions|"
"position|size|separator|items",
&command_bar, NULL);
hook_command (NULL, "buffer",
N_("manage buffers"),
+6 -30
View File
@@ -594,12 +594,18 @@ config_weechat_bar_read (void *data, struct t_config_file *config_file,
case GUI_BAR_OPTION_TYPE:
ptr_temp_bar->type = ptr_option;
break;
case GUI_BAR_OPTION_CONDITIONS:
ptr_temp_bar->conditions = ptr_option;
break;
case GUI_BAR_OPTION_POSITION:
ptr_temp_bar->position = ptr_option;
break;
case GUI_BAR_OPTION_SIZE:
ptr_temp_bar->size = ptr_option;
break;
case GUI_BAR_OPTION_SIZE_MAX:
ptr_temp_bar->size_max = ptr_option;
break;
case GUI_BAR_OPTION_SEPARATOR:
ptr_temp_bar->separator = ptr_option;
break;
@@ -619,36 +625,6 @@ config_weechat_bar_read (void *data, struct t_config_file *config_file,
return 1;
}
/*
* config_weechat_bar_write: write bar section in configuration file
* Return: 0 = successful
* -1 = write error
*/
void
config_weechat_bar_write (void *data, struct t_config_file *config_file,
char *section_name)
{
struct t_gui_bar *ptr_bar;
/* make C compiler happy */
(void) data;
config_file_write_line (config_file, section_name, NULL);
for (ptr_bar = gui_bars; ptr_bar; ptr_bar = ptr_bar->next_bar)
{
config_file_write_line (config_file,
ptr_bar->name,
"%s;%s;%d;%d;%s",
gui_bar_type_str[CONFIG_INTEGER(ptr_bar->type)],
gui_bar_position_str[CONFIG_INTEGER(ptr_bar->position)],
CONFIG_INTEGER(ptr_bar->size),
CONFIG_INTEGER(ptr_bar->separator),
CONFIG_STRING(ptr_bar->items));
}
}
/*
* config_weechat_filter_read: read filter option from config file
* return 1 if ok, 0 if error
+6 -17
View File
@@ -304,15 +304,8 @@ gui_bar_window_new (struct t_gui_bar *bar, struct t_gui_window *window)
if (window)
{
/* bar is type "window_active" and window is not active */
if ((CONFIG_INTEGER(bar->type) == GUI_BAR_TYPE_WINDOW_ACTIVE)
&& gui_current_window
&& (gui_current_window != window))
return 1;
/* bar is type "window_inactive" and window is active */
if ((CONFIG_INTEGER(bar->type) == GUI_BAR_TYPE_WINDOW_INACTIVE)
&& (!gui_current_window || (gui_current_window == window)))
if ((CONFIG_INTEGER(bar->type) == GUI_BAR_TYPE_WINDOW)
&& (!gui_bar_check_conditions_for_window (bar, window)))
return 1;
}
@@ -488,10 +481,8 @@ gui_bar_window_remove_unused_bars (struct t_gui_window *window)
{
next_bar_win = ptr_bar_win->next_bar_window;
if (((CONFIG_INTEGER(ptr_bar_win->bar->type) == GUI_BAR_TYPE_WINDOW_ACTIVE)
&& (window != gui_current_window))
|| ((CONFIG_INTEGER(ptr_bar_win->bar->type) == GUI_BAR_TYPE_WINDOW_INACTIVE)
&& (window == gui_current_window)))
if ((CONFIG_INTEGER(ptr_bar_win->bar->type) == GUI_BAR_TYPE_WINDOW)
&& (!gui_bar_check_conditions_for_window (ptr_bar_win->bar, window)))
{
gui_bar_window_free (ptr_bar_win, window);
rc = 1;
@@ -519,10 +510,8 @@ gui_bar_window_add_missing_bars (struct t_gui_window *window)
for (ptr_bar = gui_bars; ptr_bar; ptr_bar = ptr_bar->next_bar)
{
if (((CONFIG_INTEGER(ptr_bar->type) == GUI_BAR_TYPE_WINDOW_ACTIVE)
&& (window == gui_current_window))
|| ((CONFIG_INTEGER(ptr_bar->type) == GUI_BAR_TYPE_WINDOW_INACTIVE)
&& (window != gui_current_window)))
if ((CONFIG_INTEGER(ptr_bar->type) == GUI_BAR_TYPE_WINDOW)
&& gui_bar_check_conditions_for_window (ptr_bar, window))
{
if (!gui_bar_window_search_bar (window, ptr_bar))
{
+4
View File
@@ -317,6 +317,8 @@ gui_chat_draw_title (struct t_gui_buffer *buffer, int erase)
if (title_decoded)
free (title_decoded);
buffer->title_refresh_needed = 0;
}
/*
@@ -1276,6 +1278,8 @@ gui_chat_draw (struct t_gui_buffer *buffer, int erase)
ptr_line->refresh_needed = 0;
}
}
buffer->chat_refresh_needed = 0;
}
/*
+2
View File
@@ -423,4 +423,6 @@ gui_input_draw (struct t_gui_buffer *buffer, int erase)
refresh ();
}
}
buffer->input_refresh_needed = 0;
}
+4 -14
View File
@@ -206,14 +206,11 @@ gui_main_loop ()
/* refresh window if needed */
if (gui_window_refresh_needed)
gui_window_refresh_screen (0);
gui_window_refresh_screen ();
/* refresh status bar if needed */
if (gui_status_refresh_needed)
{
gui_status_draw (1);
gui_status_refresh_needed = 0;
}
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
{
@@ -230,29 +227,22 @@ gui_main_loop ()
{
/* refresh title if needed */
if (ptr_buffer->title_refresh_needed)
{
gui_chat_draw_title (ptr_buffer, 1);
ptr_buffer->title_refresh_needed = 0;
}
/* refresh chat if needed */
if (ptr_buffer->chat_refresh_needed)
{
gui_chat_draw (ptr_buffer,
(ptr_buffer->chat_refresh_needed) > 1 ? 1 : 0);
ptr_buffer->chat_refresh_needed = 0;
}
/* refresh nicklist if needed */
if (ptr_buffer->nicklist_refresh_needed)
{
gui_nicklist_draw (ptr_buffer, 1);
ptr_buffer->nicklist_refresh_needed = 0;
}
/* refresh input if needed */
if (ptr_buffer->input_refresh_needed)
{
gui_input_draw (ptr_buffer, 1);
ptr_buffer->input_refresh_needed = 0;
}
}
/* wait for keyboard or network activity */
+2
View File
@@ -316,4 +316,6 @@ gui_nicklist_draw (struct t_gui_buffer *buffer, int erase)
refresh ();
}
}
buffer->nicklist_refresh_needed = 0;
}
+2
View File
@@ -249,4 +249,6 @@ gui_status_draw (int erase)
wnoutrefresh (GUI_CURSES(ptr_win)->win_status);
refresh ();
}
gui_status_refresh_needed = 0;
}
+60 -52
View File
@@ -501,40 +501,6 @@ gui_window_redraw_all_buffers ()
}
}
/*
* gui_window_switch: switch to another window
*/
void
gui_window_switch (struct t_gui_window *window)
{
struct t_gui_window *old_window;
int changes;
if (gui_current_window == window)
return;
old_window = gui_current_window;
gui_current_window = window;
changes = gui_bar_window_remove_unused_bars (old_window)
|| gui_bar_window_add_missing_bars (old_window);
if (changes)
{
gui_current_window = old_window;
gui_window_switch_to_buffer (gui_current_window,
gui_current_window->buffer);
gui_current_window = window;
}
gui_bar_window_remove_unused_bars (gui_current_window);
gui_bar_window_add_missing_bars (gui_current_window);
gui_window_switch_to_buffer (gui_current_window,
gui_current_window->buffer);
gui_window_redraw_buffer (gui_current_window->buffer);
}
/*
* gui_window_switch_to_buffer: switch to another buffer in a window
*/
@@ -544,6 +510,7 @@ gui_window_switch_to_buffer (struct t_gui_window *window,
struct t_gui_buffer *buffer)
{
struct t_gui_bar_window *ptr_bar_win;
struct t_gui_buffer *old_buffer;
if (!gui_ok)
return;
@@ -551,6 +518,8 @@ gui_window_switch_to_buffer (struct t_gui_window *window,
if (window->buffer->num_displayed > 0)
window->buffer->num_displayed--;
old_buffer = window->buffer;
if (window->buffer != buffer)
{
window->start_line = NULL;
@@ -565,8 +534,14 @@ gui_window_switch_to_buffer (struct t_gui_window *window,
window->win_title_start = 0;
window->win_nick_start = 0;
if (old_buffer == buffer)
{
gui_bar_window_remove_unused_bars (window);
gui_bar_window_add_missing_bars (window);
}
gui_window_calculate_pos_size (window, 1);
/* create bar windows */
for (ptr_bar_win = GUI_CURSES(window)->bar_windows; ptr_bar_win;
ptr_bar_win = ptr_bar_win->next_bar_window)
@@ -624,6 +599,12 @@ gui_window_switch_to_buffer (struct t_gui_window *window,
buffer->num_displayed++;
gui_hotlist_remove_buffer (buffer);
if (buffer != old_buffer)
{
gui_bar_window_remove_unused_bars (window);
gui_bar_window_add_missing_bars (window);
}
/* redraw bars in window */
for (ptr_bar_win = GUI_CURSES(window)->bar_windows; ptr_bar_win;
@@ -636,6 +617,38 @@ gui_window_switch_to_buffer (struct t_gui_window *window,
WEECHAT_HOOK_SIGNAL_POINTER, buffer);
}
/*
* gui_window_switch: switch to another window
*/
void
gui_window_switch (struct t_gui_window *window)
{
struct t_gui_window *old_window;
int changes;
if (gui_current_window == window)
return;
old_window = gui_current_window;
gui_current_window = window;
changes = gui_bar_window_remove_unused_bars (old_window)
|| gui_bar_window_add_missing_bars (old_window);
if (changes)
{
gui_current_window = old_window;
gui_window_switch_to_buffer (gui_current_window,
gui_current_window->buffer);
gui_current_window = window;
}
gui_window_switch_to_buffer (gui_current_window,
gui_current_window->buffer);
gui_window_redraw_buffer (gui_current_window->buffer);
}
/*
* gui_window_page_up: display previous page on buffer
*/
@@ -1548,29 +1561,25 @@ gui_window_switch_right (struct t_gui_window *window)
*/
void
gui_window_refresh_screen (int force)
gui_window_refresh_screen ()
{
int new_height, new_width;
if (force || (gui_window_refresh_needed == 1))
endwin ();
refresh ();
getmaxyx (stdscr, new_height, new_width);
gui_ok = ((new_width >= GUI_WINDOW_MIN_WIDTH)
&& (new_height >= GUI_WINDOW_MIN_HEIGHT));
if (gui_ok)
{
endwin ();
refresh ();
getmaxyx (stdscr, new_height, new_width);
gui_ok = ((new_width >= GUI_WINDOW_MIN_WIDTH)
&& (new_height >= GUI_WINDOW_MIN_HEIGHT));
if (gui_ok)
{
refresh ();
gui_window_refresh_windows ();
}
gui_window_refresh_windows ();
}
if (gui_window_refresh_needed > 0)
gui_window_refresh_needed = 0;
gui_window_refresh_needed = 0;
}
/*
@@ -1581,7 +1590,6 @@ void
gui_window_refresh_screen_sigwinch ()
{
gui_window_refresh_needed = 1;
//gui_window_refresh_screen (0);
}
/*
+5 -9
View File
@@ -208,11 +208,9 @@ gui_bar_window_remove_unused_bars (struct t_gui_window *window)
while (ptr_bar_win)
{
next_bar_win = ptr_bar_win->next_bar_window;
if (((CONFIG_INTEGER(ptr_bar_win->bar->type) == GUI_BAR_TYPE_WINDOW_ACTIVE)
&& (window != gui_current_window))
|| ((CONFIG_INTEGER(ptr_bar_win->bar->type) == GUI_BAR_TYPE_WINDOW_INACTIVE)
&& (window == gui_current_window)))
if ((CONFIG_INTEGER(ptr_bar_win->bar->type) == GUI_BAR_TYPE_WINDOW)
&& (!gui_bar_check_conditions_for_window (ptr_bar_win->bar, window)))
{
gui_bar_window_free (ptr_bar_win, window);
rc = 1;
@@ -240,10 +238,8 @@ gui_bar_window_add_missing_bars (struct t_gui_window *window)
for (ptr_bar = gui_bars; ptr_bar; ptr_bar = ptr_bar->next_bar)
{
if (((CONFIG_INTEGER(ptr_bar->type) == GUI_BAR_TYPE_WINDOW_ACTIVE)
&& (window == gui_current_window))
|| ((CONFIG_INTEGER(ptr_bar->type) == GUI_BAR_TYPE_WINDOW_INACTIVE)
&& (window != gui_current_window)))
if ((CONFIG_INTEGER(ptr_bar->type) == GUI_BAR_TYPE_WINDOW)
&& gui_bar_check_conditions_for_window (ptr_bar, window))
{
if (!gui_bar_window_search_bar (window, ptr_bar))
{
+256 -29
View File
@@ -32,14 +32,15 @@
#include "../core/wee-log.h"
#include "../core/wee-string.h"
#include "gui-bar.h"
#include "gui-buffer.h"
#include "gui-chat.h"
#include "gui-window.h"
char *gui_bar_option_str[GUI_BAR_NUM_OPTIONS] =
{ "type", "position", "size", "separator", "items" };
{ "type", "conditions", "position", "size", "size_max", "separator", "items" };
char *gui_bar_type_str[GUI_BAR_NUM_TYPES] =
{ "root", "window", "window_active", "window_inactive" };
{ "root", "window" };
char *gui_bar_position_str[GUI_BAR_NUM_POSITIONS] =
{ "bottom", "top", "left", "right" };
@@ -114,6 +115,40 @@ gui_bar_search_position (char *position)
return -1;
}
/*
* gui_bar_check_conditions_for_window: return 1 if bar should be displayed in
* this window, according to condition(s)
* on bar
*/
int
gui_bar_check_conditions_for_window (struct t_gui_bar *bar,
struct t_gui_window *window)
{
int i;
for (i = 0; i < bar->conditions_count; i++)
{
if (string_strcasecmp (bar->conditions_array[i], "active") == 0)
{
if (gui_current_window && (gui_current_window != window))
return 0;
}
else if (string_strcasecmp (bar->conditions_array[i], "inactive") == 0)
{
if (!gui_current_window || (gui_current_window == window))
return 0;
}
else if (string_strcasecmp (bar->conditions_array[i], "nicklist") == 0)
{
if (window->buffer && !window->buffer->nicklist)
return 0;
}
}
return 1;
}
/*
* gui_bar_root_get_size: get total bar size ("root" type) for a position
*/
@@ -254,6 +289,40 @@ gui_bar_config_check_type (void *data, struct t_config_option *option,
return 0;
}
/*
* gui_bar_config_change_conditions: callback when conditions is changed
*/
void
gui_bar_config_change_conditions (void *data, struct t_config_option *option)
{
struct t_gui_bar *ptr_bar;
/* make C compiler happy */
(void) data;
ptr_bar = gui_bar_search_with_option_name (option->name);
if (ptr_bar)
{
if (ptr_bar->conditions_array)
string_free_exploded (ptr_bar->conditions_array);
if (CONFIG_STRING(ptr_bar->conditions) && CONFIG_STRING(ptr_bar->conditions)[0])
{
ptr_bar->conditions_array = string_explode (CONFIG_STRING(ptr_bar->conditions),
",", 0, 0,
&ptr_bar->conditions_count);
}
else
{
ptr_bar->conditions_count = 0;
ptr_bar->conditions_array = NULL;
}
}
gui_window_refresh_needed = 1;
}
/*
* gui_bar_config_change_position: callback when position is changed
*/
@@ -306,7 +375,6 @@ gui_bar_config_check_size (void *data, struct t_config_option *option,
return 0;
}
/*
* gui_bar_config_change_size: callback when size is changed
*/
@@ -328,6 +396,31 @@ gui_bar_config_change_size (void *data, struct t_config_option *option)
}
}
/*
* gui_bar_config_change_size_max: callback when max size is changed
*/
void
gui_bar_config_change_size_max (void *data, struct t_config_option *option)
{
struct t_gui_bar *ptr_bar;
/* make C compiler happy */
(void) data;
ptr_bar = gui_bar_search_with_option_name (option->name);
if (ptr_bar)
{
if ((CONFIG_INTEGER(ptr_bar->size_max) > 0)
&& (ptr_bar->current_size > CONFIG_INTEGER(ptr_bar->size_max)))
{
gui_bar_set_current_size (ptr_bar,
CONFIG_INTEGER(ptr_bar->size_max));
}
gui_window_refresh_needed = 1;
}
}
/*
* gui_bar_config_change_separator: callback when separator is changed
*/
@@ -398,10 +491,14 @@ gui_bar_set_name (struct t_gui_bar *bar, char *name)
{
snprintf (option_name, length, "%s.type", name);
config_file_option_rename (bar->type, option_name);
snprintf (option_name, length, "%s.conditions", name);
config_file_option_rename (bar->conditions, option_name);
snprintf (option_name, length, "%s.position", name);
config_file_option_rename (bar->position, option_name);
snprintf (option_name, length, "%s.size", name);
config_file_option_rename (bar->size, option_name);
snprintf (option_name, length, "%s.size_max", name);
config_file_option_rename (bar->size_max, option_name);
snprintf (option_name, length, "%s.separator", name);
config_file_option_rename (bar->separator, option_name);
snprintf (option_name, length, "%s.items", name);
@@ -535,6 +632,10 @@ gui_bar_set_current_size (struct t_gui_bar *bar, int current_size)
if (current_size == 0)
current_size = 1;
if ((CONFIG_INTEGER(bar->size_max) > 0)
&& (current_size > CONFIG_INTEGER(bar->size_max)))
current_size = CONFIG_INTEGER(bar->size_max);
/* check if new size is ok if it's more than before */
if (current_size > bar->current_size
&& !gui_bar_check_size_add (bar, current_size - bar->current_size))
@@ -584,48 +685,50 @@ gui_bar_set_size (struct t_gui_bar *bar, char *size)
}
/*
* gui_bar_set_items: set items for a bar
* gui_bar_set_size_max: set max size for a bar
*/
void
gui_bar_set_items (struct t_gui_bar *bar, char *items)
gui_bar_set_size_max (struct t_gui_bar *bar, char *size)
{
config_file_option_set (bar->items, items, 1);
long number;
char *error, value[32];
if (bar->items_array)
string_free_exploded (bar->items_array);
if (CONFIG_STRING(bar->items) && CONFIG_STRING(bar->items)[0])
error = NULL;
number = strtol (size, &error, 10);
if (error && !error[0])
{
bar->items_array = string_explode (CONFIG_STRING(bar->items),
",", 0, 0,
&bar->items_count);
}
else
{
bar->items_count = 0;
bar->items_array = NULL;
if (number < 0)
return;
snprintf (value, sizeof (value), "%ld", number);
config_file_option_set (bar->size_max, value, 1);
if ((number > 0) && (number < bar->current_size))
gui_bar_set_size (bar, value);
}
}
/*
* gui_bar_set: set a property for bar
* return: 1 if ok, 0 if error
*/
void
int
gui_bar_set (struct t_gui_bar *bar, char *property, char *value)
{
long number;
char *error;
if (!bar || !property || !value)
return;
return 0;
if (string_strcasecmp (property, "name") == 0)
{
gui_bar_set_name (bar, value);
return 1;
}
if (string_strcasecmp (property, "number") == 0)
else if (string_strcasecmp (property, "number") == 0)
{
error = NULL;
number = strtol (value, &error, 10);
@@ -634,16 +737,31 @@ gui_bar_set (struct t_gui_bar *bar, char *property, char *value)
gui_bar_set_number (bar, number);
gui_window_refresh_needed = 1;
}
return 1;
}
else if (string_strcasecmp (property, "conditions") == 0)
{
config_file_option_set (bar->conditions, value, 1);
gui_window_refresh_needed = 1;
return 1;
}
else if (string_strcasecmp (property, "position") == 0)
{
gui_bar_set_position (bar, value);
gui_bar_refresh (bar);
return 1;
}
else if (string_strcasecmp (property, "size") == 0)
{
gui_bar_set_size (bar, value);
gui_bar_refresh (bar);
return 1;
}
else if (string_strcasecmp (property, "size_max") == 0)
{
gui_bar_set_size_max (bar, value);
gui_bar_refresh (bar);
return 1;
}
else if (string_strcasecmp (property, "separator") == 0)
{
@@ -651,12 +769,16 @@ gui_bar_set (struct t_gui_bar *bar, char *property, char *value)
(strcmp (value, "1") == 0) ? "on" : "off",
1);
gui_bar_refresh (bar);
return 1;
}
else if (string_strcasecmp (property, "items") == 0)
{
gui_bar_set_items (bar, value);
config_file_option_set (bar->items, value, 1);
gui_bar_draw (bar);
return 1;
}
return 0;
}
/*
@@ -675,11 +797,15 @@ gui_bar_alloc (char *name)
new_bar->number = 0;
new_bar->name = strdup (name);
new_bar->type = NULL;
new_bar->conditions = NULL;
new_bar->position = NULL;
new_bar->size = NULL;
new_bar->size_max = NULL;
new_bar->separator = NULL;
new_bar->items = NULL;
new_bar->current_size = 1;
new_bar->conditions_count = 0;
new_bar->conditions_array = NULL;
new_bar->items_count = 0;
new_bar->items_array = NULL;
new_bar->bar_window = NULL;
@@ -720,6 +846,15 @@ gui_bar_create_option (char *bar_name, int index_option, char *value)
"root|window|window_active|window_inactive", 0, 0, value,
&gui_bar_config_check_type, NULL, NULL, NULL, NULL, NULL);
break;
case GUI_BAR_OPTION_CONDITIONS:
ptr_option = config_file_new_option (
weechat_config_file, weechat_config_section_bar,
option_name, "string",
N_("condition(s) for displaying bar (for bars of type "
"\"window\")"),
NULL, 0, 0, value,
NULL, NULL, &gui_bar_config_change_conditions, NULL, NULL, NULL);
break;
case GUI_BAR_OPTION_POSITION:
ptr_option = config_file_new_option (
weechat_config_file, weechat_config_section_bar,
@@ -738,6 +873,16 @@ gui_bar_create_option (char *bar_name, int index_option, char *value)
&gui_bar_config_change_size, NULL,
NULL, NULL);
break;
case GUI_BAR_OPTION_SIZE_MAX:
ptr_option = config_file_new_option (
weechat_config_file, weechat_config_section_bar,
option_name, "integer",
N_("max bar size in chars (0 = no limit)"),
NULL, 0, INT_MAX, value,
NULL, NULL,
&gui_bar_config_change_size_max, NULL,
NULL, NULL);
break;
case GUI_BAR_OPTION_SEPARATOR:
ptr_option = config_file_new_option (
weechat_config_file, weechat_config_section_bar,
@@ -769,8 +914,10 @@ gui_bar_create_option (char *bar_name, int index_option, char *value)
struct t_gui_bar *
gui_bar_new_with_options (struct t_weechat_plugin *plugin, char *name,
struct t_config_option *type,
struct t_config_option *conditions,
struct t_config_option *position,
struct t_config_option *size,
struct t_config_option *size_max,
struct t_config_option *separator,
struct t_config_option *items)
{
@@ -784,10 +931,23 @@ gui_bar_new_with_options (struct t_weechat_plugin *plugin, char *name,
new_bar->plugin = plugin;
new_bar->number = (last_gui_bar) ? last_gui_bar->number + 1 : 1;
new_bar->type = type;
new_bar->conditions = conditions;
if (CONFIG_STRING(conditions) && CONFIG_STRING(conditions)[0])
{
new_bar->conditions_array = string_explode (CONFIG_STRING(conditions),
",", 0, 0,
&new_bar->conditions_count);
}
else
{
new_bar->conditions_count = 0;
new_bar->conditions_array = NULL;
}
new_bar->position = position;
new_bar->size = size;
new_bar->current_size = (CONFIG_INTEGER(size) == 0) ?
1 : CONFIG_INTEGER(size);
new_bar->size_max = size_max;
new_bar->separator = separator;
new_bar->items = items;
if (CONFIG_STRING(items) && CONFIG_STRING(items)[0])
@@ -839,11 +999,12 @@ gui_bar_new_with_options (struct t_weechat_plugin *plugin, char *name,
struct t_gui_bar *
gui_bar_new (struct t_weechat_plugin *plugin, char *name,
char *type, char *position, char *size, char *separators,
char *items)
char *type, char *conditions, char *position, char *size,
char *size_max, char *separators, char *items)
{
struct t_config_option *option_type, *option_position, *option_size;
struct t_config_option *option_separator, *option_items;
struct t_config_option *option_type, *option_conditions, *option_position;
struct t_config_option *option_size, *option_size_max, *option_separator;
struct t_config_option *option_items;
struct t_gui_bar *new_bar;
if (!name || !name[0])
@@ -863,26 +1024,35 @@ gui_bar_new (struct t_weechat_plugin *plugin, char *name,
option_type = gui_bar_create_option (name, GUI_BAR_OPTION_TYPE,
type);
option_conditions = gui_bar_create_option (name, GUI_BAR_OPTION_CONDITIONS,
conditions);
option_position = gui_bar_create_option (name, GUI_BAR_OPTION_POSITION,
position);
option_size = gui_bar_create_option (name, GUI_BAR_OPTION_SIZE,
size);
option_size_max = gui_bar_create_option (name, GUI_BAR_OPTION_SIZE_MAX,
size_max);
option_separator = gui_bar_create_option (name, GUI_BAR_OPTION_SEPARATOR,
(config_file_string_to_boolean (separators)) ?
"on" : "off");
option_items = gui_bar_create_option (name, GUI_BAR_OPTION_ITEMS,
items);
new_bar = gui_bar_new_with_options (plugin, name, option_type,
option_position, option_size,
option_conditions, option_position,
option_size, option_size_max,
option_separator, option_items);
if (!new_bar)
{
if (option_type)
config_file_option_free (option_type);
if (option_conditions)
config_file_option_free (option_conditions);
if (option_position)
config_file_option_free (option_position);
if (option_size)
config_file_option_free (option_size);
if (option_size_max)
config_file_option_free (option_size_max);
if (option_separator)
config_file_option_free (option_separator);
if (option_items)
@@ -904,14 +1074,51 @@ gui_bar_use_temp_bars ()
for (ptr_temp_bar = gui_temp_bars; ptr_temp_bar;
ptr_temp_bar = ptr_temp_bar->next_bar)
{
if (ptr_temp_bar->type && ptr_temp_bar->position
&& ptr_temp_bar->size && ptr_temp_bar->separator
if (!ptr_temp_bar->type)
ptr_temp_bar->type = gui_bar_create_option (ptr_temp_bar->name,
GUI_BAR_OPTION_TYPE,
"0");
if (!ptr_temp_bar->conditions)
ptr_temp_bar->conditions = gui_bar_create_option (ptr_temp_bar->name,
GUI_BAR_OPTION_CONDITIONS,
"");
if (!ptr_temp_bar->position)
ptr_temp_bar->position = gui_bar_create_option (ptr_temp_bar->name,
GUI_BAR_OPTION_POSITION,
"top");
if (!ptr_temp_bar->size)
ptr_temp_bar->size = gui_bar_create_option (ptr_temp_bar->name,
GUI_BAR_OPTION_SIZE,
"0");
if (!ptr_temp_bar->size_max)
ptr_temp_bar->size_max = gui_bar_create_option (ptr_temp_bar->name,
GUI_BAR_OPTION_SIZE_MAX,
"0");
if (!ptr_temp_bar->separator)
ptr_temp_bar->separator = gui_bar_create_option (ptr_temp_bar->name,
GUI_BAR_OPTION_SEPARATOR,
"off");
if (!ptr_temp_bar->items)
ptr_temp_bar->items = gui_bar_create_option (ptr_temp_bar->name,
GUI_BAR_OPTION_ITEMS,
"");
if (ptr_temp_bar->type && ptr_temp_bar->conditions
&& ptr_temp_bar->position && ptr_temp_bar->size
&& ptr_temp_bar->size_max && ptr_temp_bar->separator
&& ptr_temp_bar->items)
{
gui_bar_new_with_options (NULL, ptr_temp_bar->name,
ptr_temp_bar->type,
ptr_temp_bar->conditions,
ptr_temp_bar->position,
ptr_temp_bar->size,
ptr_temp_bar->size_max,
ptr_temp_bar->separator,
ptr_temp_bar->items);
}
@@ -922,6 +1129,11 @@ gui_bar_use_temp_bars ()
config_file_option_free (ptr_temp_bar->type);
ptr_temp_bar->type = NULL;
}
if (ptr_temp_bar->conditions)
{
config_file_option_free (ptr_temp_bar->conditions);
ptr_temp_bar->conditions = NULL;
}
if (ptr_temp_bar->position)
{
config_file_option_free (ptr_temp_bar->position);
@@ -932,6 +1144,11 @@ gui_bar_use_temp_bars ()
config_file_option_free (ptr_temp_bar->size);
ptr_temp_bar->size = NULL;
}
if (ptr_temp_bar->size_max)
{
config_file_option_free (ptr_temp_bar->size_max);
ptr_temp_bar->size_max = NULL;
}
if (ptr_temp_bar->separator)
{
config_file_option_free (ptr_temp_bar->separator);
@@ -1006,14 +1223,20 @@ gui_bar_free (struct t_gui_bar *bar)
free (bar->name);
if (bar->type)
config_file_option_free (bar->type);
if (bar->conditions)
config_file_option_free (bar->conditions);
if (bar->position)
config_file_option_free (bar->position);
if (bar->size)
config_file_option_free (bar->size);
if (bar->size_max)
config_file_option_free (bar->size_max);
if (bar->separator)
config_file_option_free (bar->separator);
if (bar->items)
config_file_option_free (bar->items);
if (bar->conditions_array)
string_free_exploded (bar->conditions_array);
if (bar->items_array)
string_free_exploded (bar->items_array);
@@ -1073,10 +1296,14 @@ gui_bar_print_log ()
log_printf (" type . . . . . . . . . : %d (%s)",
CONFIG_INTEGER(ptr_bar->type),
gui_bar_type_str[CONFIG_INTEGER(ptr_bar->type)]);
log_printf (" conditions . . . . . . : '%s'", CONFIG_STRING(ptr_bar->conditions));
log_printf (" conditions_count . . . : %d", ptr_bar->conditions_count);
log_printf (" conditions_array . . . : 0x%x", ptr_bar->conditions_array);
log_printf (" position . . . . . . . : %d (%s)",
CONFIG_INTEGER(ptr_bar->position),
gui_bar_position_str[CONFIG_INTEGER(ptr_bar->position)]);
log_printf (" size . . . . . . . . . : %d", CONFIG_INTEGER(ptr_bar->size));
log_printf (" size_max . . . . . . . : %d", CONFIG_INTEGER(ptr_bar->size_max));
log_printf (" current_size . . . . . : %d", ptr_bar->current_size);
log_printf (" separator. . . . . . . : %d", CONFIG_INTEGER(ptr_bar->separator));
log_printf (" items. . . . . . . . . : '%s'", CONFIG_STRING(ptr_bar->items));
+21 -13
View File
@@ -26,8 +26,10 @@ struct t_gui_window;
enum t_gui_bar_option
{
GUI_BAR_OPTION_TYPE = 0,
GUI_BAR_OPTION_CONDITIONS,
GUI_BAR_OPTION_POSITION,
GUI_BAR_OPTION_SIZE,
GUI_BAR_OPTION_SIZE_MAX,
GUI_BAR_OPTION_SEPARATOR,
GUI_BAR_OPTION_ITEMS,
/* number of bar types */
@@ -38,8 +40,6 @@ enum t_gui_bar_type
{
GUI_BAR_TYPE_ROOT = 0,
GUI_BAR_TYPE_WINDOW,
GUI_BAR_TYPE_WINDOW_ACTIVE,
GUI_BAR_TYPE_WINDOW_INACTIVE,
/* number of bar types */
GUI_BAR_NUM_TYPES,
};
@@ -57,17 +57,21 @@ enum t_gui_bar_position
struct t_gui_bar
{
/* user choices */
struct t_weechat_plugin *plugin; /* plugin */
int number; /* bar number */
char *name; /* bar name */
struct t_config_option *type; /* type (root or window) */
struct t_config_option *position; /* bottom, top, left, right */
struct t_config_option *size; /* size of bar (in chars, 0 = auto) */
struct t_config_option *separator; /* true if separator line displayed */
struct t_config_option *items; /* bar items */
struct t_weechat_plugin *plugin; /* plugin */
int number; /* bar number */
char *name; /* bar name */
struct t_config_option *type; /* type (root or window) */
struct t_config_option *conditions; /* conditions for display */
struct t_config_option *position; /* bottom, top, left, right */
struct t_config_option *size; /* size of bar (in chars, 0 = auto) */
struct t_config_option *size_max; /* max size of bar (0 = no limit) */
struct t_config_option *separator; /* true if separator line displayed */
struct t_config_option *items; /* bar items */
/* internal vars */
int current_size; /* current bar size (strictly > 0) */
int conditions_count; /* number of conditions */
char **conditions_array; /* exploded bar conditions */
int items_count; /* number of bar items */
char **items_array; /* exploded bar items */
struct t_gui_bar_window *bar_window; /* pointer to bar window */
@@ -90,18 +94,22 @@ extern struct t_gui_bar *last_gui_temp_bar;
extern int gui_bar_search_option (char *option_name);
extern int gui_bar_search_type (char *type);
extern int gui_bar_search_position (char *position);
extern int gui_bar_check_conditions_for_window (struct t_gui_bar *bar,
struct t_gui_window *window);
extern int gui_bar_root_get_size (struct t_gui_bar *bar,
enum t_gui_bar_position position);
extern struct t_gui_bar *gui_bar_search (char *name);
extern void gui_bar_set_current_size (struct t_gui_bar *bar, int current_size);
extern void gui_bar_set (struct t_gui_bar *bar, char *property, char *value);
extern int gui_bar_set (struct t_gui_bar *bar, char *property, char *value);
extern struct t_gui_bar *gui_bar_alloc (char *name);
extern struct t_config_option *gui_bar_create_option (char *bar_name,
int index_option,
char *value);
extern struct t_gui_bar *gui_bar_new (struct t_weechat_plugin *plugin,
char *name, char *type, char *position,
char *size, char *separator, char *items);
char *name, char *type, char *conditions,
char *position, char *size,
char *size_max, char *separator,
char *items);
extern void gui_bar_use_temp_bars ();
extern void gui_bar_update (char *name);
extern void gui_bar_free (struct t_gui_bar *bar);
+1 -1
View File
@@ -158,9 +158,9 @@ extern int gui_window_calculate_pos_size (struct t_gui_window *window,
int force_calculate);
extern void gui_window_redraw_buffer (struct t_gui_buffer *buffer);
extern void gui_window_redraw_all_buffers ();
extern void gui_window_switch (struct t_gui_window *window);
extern void gui_window_switch_to_buffer (struct t_gui_window *window,
struct t_gui_buffer *buffer);
extern void gui_window_switch (struct t_gui_window *window);
extern void gui_window_page_up (struct t_gui_window *window);
extern void gui_window_page_down (struct t_gui_window *window);
extern void gui_window_scroll_up (struct t_gui_window *window);
+13 -6
View File
@@ -3878,7 +3878,8 @@ weechat_lua_api_bar_search (lua_State *L)
static int
weechat_lua_api_bar_new (lua_State *L)
{
const char *name, *type, *position, *items, *size, *separator;
const char *name, *type, *conditions, *position, *size, *size_max;
const char *separator, *items;
char *result;
int n;
@@ -3893,30 +3894,36 @@ weechat_lua_api_bar_new (lua_State *L)
name = NULL;
type = NULL;
conditions = NULL;
position = NULL;
size = NULL;
size_max = NULL;
separator = NULL;
items = NULL;
n = lua_gettop (lua_current_interpreter);
if (n < 6)
if (n < 8)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("bar_new");
LUA_RETURN_EMPTY;
}
name = lua_tostring (lua_current_interpreter, -6);
type = lua_tostring (lua_current_interpreter, -5);
position = lua_tostring (lua_current_interpreter, -4);
size = lua_tostring (lua_current_interpreter, -3);
name = lua_tostring (lua_current_interpreter, -8);
type = lua_tostring (lua_current_interpreter, -7);
conditions = lua_tostring (lua_current_interpreter, -6);
position = lua_tostring (lua_current_interpreter, -5);
size = lua_tostring (lua_current_interpreter, -4);
size_max = lua_tostring (lua_current_interpreter, -3);
separator = lua_tostring (lua_current_interpreter, -2);
items = lua_tostring (lua_current_interpreter, -1);
result = script_ptr2str (weechat_bar_new ((char *)name,
(char *)type,
(char *)conditions,
(char *)position,
(char *)size,
(char *)size_max,
(char *)separator,
(char *)items));
+11 -6
View File
@@ -3219,7 +3219,8 @@ static XS (XS_weechat_bar_search)
static XS (XS_weechat_bar_new)
{
char *result, *name, *type, *position, *size, *separator, *bar_items;
char *result, *name, *type, *conditions, *position, *size, *size_max;
char *separator, *bar_items;
dXSARGS;
/* make C compiler happy */
@@ -3231,7 +3232,7 @@ static XS (XS_weechat_bar_new)
PERL_RETURN_EMPTY;
}
if (items < 6)
if (items < 8)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("bar_new");
PERL_RETURN_EMPTY;
@@ -3239,14 +3240,18 @@ static XS (XS_weechat_bar_new)
name = SvPV (ST (0), PL_na);
type = SvPV (ST (1), PL_na);
position = SvPV (ST (2), PL_na);
size = SvPV (ST (3), PL_na);
separator = SvPV (ST (4), PL_na);
bar_items = SvPV (ST (5), PL_na);
conditions = SvPV (ST (2), PL_na);
position = SvPV (ST (3), PL_na);
size = SvPV (ST (4), PL_na);
size_max = SvPV (ST (5), PL_na);
separator = SvPV (ST (6), PL_na);
bar_items = SvPV (ST (7), PL_na);
result = script_ptr2str (weechat_bar_new (name,
type,
conditions,
position,
size,
size_max,
separator,
bar_items));
@@ -3426,7 +3426,8 @@ weechat_python_api_bar_search (PyObject *self, PyObject *args)
static PyObject *
weechat_python_api_bar_new (PyObject *self, PyObject *args)
{
char *name, *type, *position, *size, *separator, *items, *result;
char *name, *type, *conditions, *position, *size, *size_max, *separator;
char *items, *result;
PyObject *object;
/* make C compiler happy */
@@ -3440,13 +3441,15 @@ weechat_python_api_bar_new (PyObject *self, PyObject *args)
name = NULL;
type = NULL;
conditions = NULL;
position = NULL;
size = NULL;
size_max = NULL;
separator = NULL;
items = NULL;
if (!PyArg_ParseTuple (args, "ssssss", &name, &type, &position, &size,
&separator, &items))
if (!PyArg_ParseTuple (args, "ssssssss", &name, &conditions, &type,
&position, &size, &size_max, &separator, &items))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("bar_new");
PYTHON_RETURN_EMPTY;
@@ -3454,8 +3457,10 @@ weechat_python_api_bar_new (PyObject *self, PyObject *args)
result = script_ptr2str (weechat_bar_new (name,
type,
conditions,
position,
size,
size_max,
separator,
items));
+17 -7
View File
@@ -3942,11 +3942,12 @@ weechat_ruby_api_bar_search (VALUE class, VALUE name)
*/
static VALUE
weechat_ruby_api_bar_new (VALUE class, VALUE name, VALUE type, VALUE position,
VALUE size, VALUE separator, VALUE items)
weechat_ruby_api_bar_new (VALUE class, VALUE name, VALUE type, VALUE conditions,
VALUE position, VALUE size, VALUE size_max,
VALUE separator, VALUE items)
{
char *c_name, *c_type, *c_position, *c_size, *c_separator, *c_items;
char *result;
char *c_name, *c_type, *c_conditions, *c_position, *c_size, *c_size_max;
char *c_separator, *c_items, *result;
VALUE return_value;
/* make C compiler happy */
@@ -3960,13 +3961,16 @@ weechat_ruby_api_bar_new (VALUE class, VALUE name, VALUE type, VALUE position,
c_name = NULL;
c_type = NULL;
c_conditions = NULL;
c_position = NULL;
c_size = NULL;
c_size_max = NULL;
c_separator = NULL;
c_items = NULL;
if (NIL_P (name) || NIL_P (type) || NIL_P (position) || NIL_P (size)
|| NIL_P (separator) || NIL_P (items))
if (NIL_P (name) || NIL_P (type) || NIL_P (conditions) || NIL_P (position)
|| NIL_P (size) || NIL_P (size_max) || NIL_P (separator)
|| NIL_P (items))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("bar_new");
RUBY_RETURN_EMPTY;
@@ -3974,22 +3978,28 @@ weechat_ruby_api_bar_new (VALUE class, VALUE name, VALUE type, VALUE position,
Check_Type (name, T_STRING);
Check_Type (type, T_STRING);
Check_Type (conditions, T_STRING);
Check_Type (position, T_STRING);
Check_Type (size, T_STRING);
Check_Type (size_max, T_STRING);
Check_Type (separator, T_STRING);
Check_Type (items, T_STRING);
c_name = STR2CSTR (name);
c_type = STR2CSTR (type);
c_conditions = STR2CSTR (conditions);
c_position = STR2CSTR (position);
c_size = STR2CSTR (size);
c_size_max = STR2CSTR (size_max);
c_separator = STR2CSTR (separator);
c_items = STR2CSTR (items);
result = script_ptr2str (weechat_bar_new (c_name,
c_type,
c_conditions,
c_position,
c_size,
c_size_max,
c_separator,
c_items));
@@ -4589,7 +4599,7 @@ weechat_ruby_api_init (VALUE ruby_mWeechat)
rb_define_module_function (ruby_mWeechat, "bar_item_update", &weechat_ruby_api_bar_item_update, 1);
rb_define_module_function (ruby_mWeechat, "bar_item_remove", &weechat_ruby_api_bar_item_remove, 1);
rb_define_module_function (ruby_mWeechat, "bar_search", &weechat_ruby_api_bar_search, 1);
rb_define_module_function (ruby_mWeechat, "bar_new", &weechat_ruby_api_bar_new, 6);
rb_define_module_function (ruby_mWeechat, "bar_new", &weechat_ruby_api_bar_new, 8);
rb_define_module_function (ruby_mWeechat, "bar_set", &weechat_ruby_api_bar_set, 3);
rb_define_module_function (ruby_mWeechat, "bar_update", &weechat_ruby_api_bar_update, 1);
rb_define_module_function (ruby_mWeechat, "bar_remove", &weechat_ruby_api_bar_remove, 1);
+9 -7
View File
@@ -376,9 +376,10 @@ struct t_weechat_plugin
void (*bar_item_remove) (struct t_gui_bar_item *item);
struct t_gui_bar *(*bar_search) (char *name);
struct t_gui_bar *(*bar_new) (struct t_weechat_plugin *plugin, char *name,
char *type, char *position, char *size,
char *separator, char *items);
void (*bar_set) (struct t_gui_bar *bar, char *property, char *value);
char *type, char *condition, char *position,
char *size, char *size_max, char *separator,
char *items);
int (*bar_set) (struct t_gui_bar *bar, char *property, char *value);
void (*bar_update) (char *name);
void (*bar_remove) (struct t_gui_bar *bar);
@@ -771,10 +772,11 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
weechat_plugin->bar_item_remove(__item)
#define weechat_bar_search(__name) \
weechat_plugin->bar_search(__name)
#define weechat_bar_new(__name, __type, __position, __size, \
__separator, __items) \
weechat_plugin->bar_new(weechat_plugin, __name, __type, __position, \
__size, __separator, __items)
#define weechat_bar_new(__name, __type, __condition, __position, \
__size, __size_max, __separator, __items) \
weechat_plugin->bar_new(weechat_plugin, __name, __type, \
__condition, __position, __size, \
__size_max, __separator, __items)
#define weechat_bar_set(__bar, __property, __value) \
weechat_plugin->bar_set(__bar, __property, __value)
#define weechat_bar_update(__name) \