mirror of
https://github.com/weechat/weechat.git
synced 2026-06-25 04:16:38 +02:00
Added conditions for bar display and bar max size
This commit is contained in:
@@ -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));
|
||||
|
||||
|
||||
@@ -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));
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user