1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-28 13:56:37 +02:00

Add function window_set_title in API (task #9361)

This commit is contained in:
Sebastien Helleu
2009-05-10 01:22:08 +02:00
parent 09c42f4cf0
commit 57c6478b91
18 changed files with 353 additions and 96 deletions
+37
View File
@@ -5002,6 +5002,42 @@ weechat_lua_api_window_get_pointer (lua_State *L)
LUA_RETURN_STRING_FREE(result);
}
/*
* weechat_lua_api_window_set_title: set window title
*/
static int
weechat_lua_api_window_set_title (lua_State *L)
{
const char *title;
int n;
/* make C compiler happy */
(void) L;
if (!lua_current_script)
{
WEECHAT_SCRIPT_MSG_NOT_INIT(LUA_CURRENT_SCRIPT_NAME, "window_set_title");
LUA_RETURN_ERROR;
}
title = NULL;
n = lua_gettop (lua_current_interpreter);
if (n < 1)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(LUA_CURRENT_SCRIPT_NAME, "window_set_title");
LUA_RETURN_ERROR;
}
title = lua_tostring (lua_current_interpreter, -1);
weechat_window_set_title (title);
LUA_RETURN_OK;
}
/*
* weechat_lua_api_nicklist_add_group: add a group in nicklist
*/
@@ -7050,6 +7086,7 @@ const struct luaL_reg weechat_lua_api_funcs[] = {
{ "window_get_integer", &weechat_lua_api_window_get_integer },
{ "window_get_string", &weechat_lua_api_window_get_string },
{ "window_get_pointer", &weechat_lua_api_window_get_pointer },
{ "window_set_title", &weechat_lua_api_window_set_title },
{ "nicklist_add_group", &weechat_lua_api_nicklist_add_group },
{ "nicklist_search_group", &weechat_lua_api_nicklist_search_group },
{ "nicklist_add_nick", &weechat_lua_api_nicklist_add_nick },
@@ -4267,6 +4267,34 @@ static XS (XS_weechat_api_window_get_pointer)
PERL_RETURN_STRING_FREE(result);
}
/*
* weechat::window_set_title: set window title
*/
static XS (XS_weechat_api_window_set_title)
{
dXSARGS;
/* make C compiler happy */
(void) cv;
if (!perl_current_script)
{
WEECHAT_SCRIPT_MSG_NOT_INIT(PERL_CURRENT_SCRIPT_NAME, "window_set_title");
PERL_RETURN_ERROR;
}
if (items < 1)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(PERL_CURRENT_SCRIPT_NAME, "window_set_title");
PERL_RETURN_ERROR;
}
weechat_window_set_title (SvPV (ST (0), PL_na)); /* title */
PERL_RETURN_OK;
}
/*
* weechat::nicklist_add_group: add a group in nicklist
*/
@@ -5657,6 +5685,7 @@ weechat_perl_api_init (pTHX)
newXS ("weechat::window_get_integer", XS_weechat_api_window_get_integer, "weechat");
newXS ("weechat::window_get_string", XS_weechat_api_window_get_string, "weechat");
newXS ("weechat::window_get_pointer", XS_weechat_api_window_get_pointer, "weechat");
newXS ("weechat::window_set_title", XS_weechat_api_window_set_title, "weechat");
newXS ("weechat::nicklist_add_group", XS_weechat_api_nicklist_add_group, "weechat");
newXS ("weechat::nicklist_search_group", XS_weechat_api_nicklist_search_group, "weechat");
newXS ("weechat::nicklist_add_nick", XS_weechat_api_nicklist_add_nick, "weechat");
@@ -4298,7 +4298,7 @@ weechat_python_api_buffer_get_pointer (PyObject *self, PyObject *args)
if (!python_current_script)
{
WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "buffer_get_pointer");
PYTHON_RETURN_ERROR;
PYTHON_RETURN_EMPTY;
}
buffer = NULL;
@@ -4425,7 +4425,7 @@ weechat_python_api_window_get_string (PyObject *self, PyObject *args)
if (!python_current_script)
{
WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "window_get_string");
PYTHON_RETURN_ERROR;
PYTHON_RETURN_EMPTY;
}
window = NULL;
@@ -4458,7 +4458,7 @@ weechat_python_api_window_get_pointer (PyObject *self, PyObject *args)
if (!python_current_script)
{
WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "window_get_pointer");
PYTHON_RETURN_ERROR;
PYTHON_RETURN_EMPTY;
}
window = NULL;
@@ -4476,6 +4476,37 @@ weechat_python_api_window_get_pointer (PyObject *self, PyObject *args)
PYTHON_RETURN_STRING_FREE(result);
}
/*
* weechat_python_api_window_set_title: set window title
*/
static PyObject *
weechat_python_api_window_set_title (PyObject *self, PyObject *args)
{
char *title;
/* make C compiler happy */
(void) self;
if (!python_current_script)
{
WEECHAT_SCRIPT_MSG_NOT_INIT(PYTHON_CURRENT_SCRIPT_NAME, "window_set_title");
PYTHON_RETURN_ERROR;
}
title = NULL;
if (!PyArg_ParseTuple (args, "s", &title))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(PYTHON_CURRENT_SCRIPT_NAME, "window_set_title");
PYTHON_RETURN_ERROR;
}
weechat_window_set_title (title);
PYTHON_RETURN_OK;
}
/*
* weechat_python_api_nicklist_add_group: add a group in nicklist
*/
@@ -5932,6 +5963,7 @@ PyMethodDef weechat_python_funcs[] =
{ "window_get_integer", &weechat_python_api_window_get_integer, METH_VARARGS, "" },
{ "window_get_string", &weechat_python_api_window_get_string, METH_VARARGS, "" },
{ "window_get_pointer", &weechat_python_api_window_get_pointer, METH_VARARGS, "" },
{ "window_set_title", &weechat_python_api_window_set_title, METH_VARARGS, "" },
{ "nicklist_add_group", &weechat_python_api_nicklist_add_group, METH_VARARGS, "" },
{ "nicklist_search_group", &weechat_python_api_nicklist_search_group, METH_VARARGS, "" },
{ "nicklist_add_nick", &weechat_python_api_nicklist_add_nick, METH_VARARGS, "" },
@@ -5145,6 +5145,39 @@ weechat_ruby_api_window_get_pointer (VALUE class, VALUE window, VALUE property)
RUBY_RETURN_STRING_FREE(result);
}
/*
* weechat_ruby_api_window_set_title: set window title
*/
static VALUE
weechat_ruby_api_window_set_title (VALUE class, VALUE title)
{
char *c_title;
/* make C compiler happy */
(void) class;
if (!ruby_current_script)
{
WEECHAT_SCRIPT_MSG_NOT_INIT(RUBY_CURRENT_SCRIPT_NAME, "window_set_title");
RUBY_RETURN_ERROR;
}
if (NIL_P (title))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(RUBY_CURRENT_SCRIPT_NAME, "window_set_title");
RUBY_RETURN_ERROR;
}
Check_Type (title, T_STRING);
c_title = STR2CSTR (title);
weechat_window_set_title (c_title);
RUBY_RETURN_OK;
}
/*
* weechat_ruby_api_nicklist_add_group: add a group in nicklist
*/
@@ -6843,6 +6876,7 @@ weechat_ruby_api_init (VALUE ruby_mWeechat)
rb_define_module_function (ruby_mWeechat, "window_get_integer", &weechat_ruby_api_window_get_integer, 2);
rb_define_module_function (ruby_mWeechat, "window_get_string", &weechat_ruby_api_window_get_string, 2);
rb_define_module_function (ruby_mWeechat, "window_get_pointer", &weechat_ruby_api_window_get_pointer, 2);
rb_define_module_function (ruby_mWeechat, "window_set_title", &weechat_ruby_api_window_set_title, 1);
rb_define_module_function (ruby_mWeechat, "nicklist_add_group", &weechat_ruby_api_nicklist_add_group, 5);
rb_define_module_function (ruby_mWeechat, "nicklist_search_group", &weechat_ruby_api_nicklist_search_group, 3);
rb_define_module_function (ruby_mWeechat, "nicklist_add_nick", &weechat_ruby_api_nicklist_add_nick, 7);
+36
View File
@@ -4773,6 +4773,40 @@ weechat_tcl_api_window_get_pointer (ClientData clientData, Tcl_Interp *interp,
TCL_RETURN_STRING_FREE(result);
}
/*
* weechat_tcl_api_window_set_title: set window title
*/
static int
weechat_tcl_api_window_set_title (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
Tcl_Obj *objp;
char *title;
int i;
/* make C compiler happy */
(void) clientData;
if (!tcl_current_script)
{
WEECHAT_SCRIPT_MSG_NOT_INIT(TCL_CURRENT_SCRIPT_NAME, "window_set_title");
TCL_RETURN_ERROR;
}
if (objc < 1)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGS(TCL_CURRENT_SCRIPT_NAME, "window_set_title");
TCL_RETURN_ERROR;
}
title = Tcl_GetStringFromObj (objv[1], &i);
weechat_window_set_title (title);
TCL_RETURN_OK;
}
/*
* weechat_tcl_api_nicklist_add_group: add a group in nicklist
*/
@@ -6478,6 +6512,8 @@ void weechat_tcl_api_init (Tcl_Interp *interp)
weechat_tcl_api_window_get_string, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
Tcl_CreateObjCommand (interp, "weechat::window_get_pointer",
weechat_tcl_api_window_get_pointer, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
Tcl_CreateObjCommand (interp, "weechat::window_set_title",
weechat_tcl_api_window_set_title, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
Tcl_CreateObjCommand (interp, "weechat::nicklist_add_group",
weechat_tcl_api_nicklist_add_group, (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
Tcl_CreateObjCommand (interp, "weechat::nicklist_search_group",