mirror of
https://github.com/weechat/weechat.git
synced 2026-07-03 16:23:14 +02:00
Add function window_set_title in API (task #9361)
This commit is contained in:
@@ -8294,6 +8294,36 @@ weechat_printf (NULL, "current window pointer is: %lx, buffer displayed is: %lx"
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="secPluginCApi_weechat_window_set_title">
|
||||
<title>weechat_window_set_title</title>
|
||||
|
||||
<para>
|
||||
Prototype:
|
||||
<programlisting>
|
||||
void weechat_window_set_title (const char *title);
|
||||
</programlisting>
|
||||
</para>
|
||||
<para>
|
||||
Set title for window (terminal for Curses interface).
|
||||
</para>
|
||||
<para>
|
||||
Arguments:
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>title</option>: new title (if empty, then title is reset)
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<para>
|
||||
Example:
|
||||
<screen>
|
||||
weechat_window_set_title ("new title");
|
||||
</screen>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
</section>
|
||||
|
||||
<!-- ============================[ nicklist ]============================ -->
|
||||
|
||||
@@ -8293,6 +8293,36 @@ weechat_printf (NULL, "current window pointer is: %lx, buffer displayed is: %lx"
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="secPluginCApi_weechat_window_set_title">
|
||||
<title>weechat_window_set_title</title>
|
||||
|
||||
<para>
|
||||
Prototype:
|
||||
<programlisting>
|
||||
void weechat_window_set_title (const char *title);
|
||||
</programlisting>
|
||||
</para>
|
||||
<para>
|
||||
Set title for window (terminal for Curses interface).
|
||||
</para>
|
||||
<para>
|
||||
Arguments:
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>title</option>: new title (if empty, then title is reset)
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<para>
|
||||
Example:
|
||||
<screen>
|
||||
weechat_window_set_title ("new title");
|
||||
</screen>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
</section>
|
||||
|
||||
<!-- ============================[ nicklist ]============================ -->
|
||||
|
||||
@@ -8294,6 +8294,36 @@ weechat_printf (NULL, "current window pointer is: %lx, buffer displayed is: %lx"
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section id="secPluginCApi_weechat_window_set_title">
|
||||
<title>weechat_window_set_title</title>
|
||||
|
||||
<para>
|
||||
Prototype:
|
||||
<programlisting>
|
||||
void weechat_window_set_title (const char *title);
|
||||
</programlisting>
|
||||
</para>
|
||||
<para>
|
||||
Set title for window (terminal for Curses interface).
|
||||
</para>
|
||||
<para>
|
||||
Arguments:
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
<option>title</option>: new title (if empty, then title is reset)
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<para>
|
||||
Example:
|
||||
<screen>
|
||||
weechat_window_set_title ("new title");
|
||||
</screen>
|
||||
</para>
|
||||
</section>
|
||||
|
||||
</section>
|
||||
|
||||
<!-- ============================[ nicklist ]============================ -->
|
||||
|
||||
@@ -214,9 +214,9 @@ config_change_title (void *data, struct t_config_option *option)
|
||||
(void) option;
|
||||
|
||||
if (CONFIG_BOOLEAN(config_look_set_title))
|
||||
gui_window_title_set ();
|
||||
gui_window_set_title (PACKAGE_NAME " " PACKAGE_VERSION);
|
||||
else
|
||||
gui_window_title_reset ();
|
||||
gui_window_set_title (NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -135,7 +135,7 @@ gui_main_init ()
|
||||
gui_current_window = gui_windows;
|
||||
|
||||
if (CONFIG_BOOLEAN(config_look_set_title))
|
||||
gui_window_title_set ();
|
||||
gui_window_set_title (PACKAGE_NAME " " PACKAGE_VERSION);
|
||||
}
|
||||
|
||||
/* create bar windows for root bars (they were read from config,
|
||||
@@ -382,7 +382,7 @@ gui_main_end (int clean_exit)
|
||||
|
||||
/* reset title */
|
||||
if (CONFIG_BOOLEAN(config_look_set_title))
|
||||
gui_window_title_reset ();
|
||||
gui_window_set_title (NULL);
|
||||
|
||||
/* end color */
|
||||
gui_color_end ();
|
||||
|
||||
@@ -1372,83 +1372,89 @@ gui_window_refresh_screen (int full_refresh)
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_window_title_set: set terminal title
|
||||
* gui_window_set_title: set terminal title
|
||||
*/
|
||||
|
||||
void
|
||||
gui_window_title_set ()
|
||||
{
|
||||
char *envterm = getenv ("TERM");
|
||||
|
||||
if (envterm)
|
||||
{
|
||||
if (strcmp( envterm, "sun-cmd") == 0)
|
||||
printf ("\033]l%s %s\033\\", PACKAGE_NAME, PACKAGE_VERSION);
|
||||
else if (strcmp(envterm, "hpterm") == 0)
|
||||
printf ("\033&f0k%dD%s %s",
|
||||
(int)(strlen(PACKAGE_NAME) + strlen(PACKAGE_VERSION) + 1),
|
||||
PACKAGE_NAME, PACKAGE_VERSION);
|
||||
/* the following term supports the xterm excapes */
|
||||
else if (strncmp (envterm, "xterm", 5) == 0
|
||||
|| strncmp (envterm, "rxvt", 4) == 0
|
||||
|| strcmp (envterm, "Eterm") == 0
|
||||
|| strcmp (envterm, "aixterm") == 0
|
||||
|| strcmp (envterm, "iris-ansi") == 0
|
||||
|| strcmp (envterm, "dtterm") == 0)
|
||||
printf ("\33]0;%s %s\7", PACKAGE_NAME, PACKAGE_VERSION);
|
||||
else if (strcmp (envterm, "screen") == 0)
|
||||
{
|
||||
printf ("\033k%s %s\033\\", PACKAGE_NAME, PACKAGE_VERSION);
|
||||
/* tryning to set the title of a backgrounded xterm like terminal */
|
||||
printf ("\33]0;%s %s\7", PACKAGE_NAME, PACKAGE_VERSION);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_window_title_reset: reset terminal title
|
||||
*/
|
||||
|
||||
void
|
||||
gui_window_title_reset ()
|
||||
gui_window_set_title (const char *title)
|
||||
{
|
||||
char *shell, *shellname;
|
||||
char *envterm = getenv ("TERM");
|
||||
char *envshell = getenv ("SHELL");
|
||||
|
||||
|
||||
if (envterm)
|
||||
{
|
||||
if (strcmp( envterm, "sun-cmd") == 0)
|
||||
printf ("\033]l%s\033\\", "Terminal");
|
||||
else if (strcmp( envterm, "hpterm") == 0)
|
||||
printf ("\033&f0k%dD%s", (int)strlen("Terminal"), "Terminal");
|
||||
/* the following term supports the xterm excapes */
|
||||
else if (strncmp (envterm, "xterm", 5) == 0
|
||||
|| strncmp (envterm, "rxvt", 4) == 0
|
||||
|| strcmp (envterm, "Eterm") == 0
|
||||
|| strcmp( envterm, "aixterm") == 0
|
||||
|| strcmp( envterm, "iris-ansi") == 0
|
||||
|| strcmp( envterm, "dtterm") == 0)
|
||||
printf ("\33]0;%s\7", "Terminal");
|
||||
else if (strcmp (envterm, "screen") == 0)
|
||||
{
|
||||
if (envshell)
|
||||
{
|
||||
shell = strdup (envshell);
|
||||
if (shell)
|
||||
{
|
||||
shellname = basename (shell);
|
||||
printf ("\033k%s\033\\", (shellname) ? shellname : shell);
|
||||
free (shell);
|
||||
}
|
||||
else
|
||||
printf ("\033k%s\033\\", envterm);
|
||||
}
|
||||
else
|
||||
printf ("\033k%s\033\\", envterm);
|
||||
/* tryning to reset the title of a backgrounded xterm like terminal */
|
||||
printf ("\33]0;%s\7", "Terminal");
|
||||
}
|
||||
if (title && title[0])
|
||||
{
|
||||
if (strcmp (envterm, "sun-cmd") == 0)
|
||||
{
|
||||
printf ("\033]l%s\033\\", title);
|
||||
}
|
||||
else if (strcmp (envterm, "hpterm") == 0)
|
||||
{
|
||||
printf ("\033&f0k%dD%s", (int)(strlen(title) + 1), title);
|
||||
}
|
||||
/* the following term supports the xterm excapes */
|
||||
else if ((strncmp (envterm, "xterm", 5) == 0)
|
||||
|| (strncmp (envterm, "rxvt", 4) == 0)
|
||||
|| (strcmp (envterm, "Eterm") == 0)
|
||||
|| (strcmp (envterm, "aixterm") == 0)
|
||||
|| (strcmp (envterm, "iris-ansi") == 0)
|
||||
|| (strcmp (envterm, "dtterm") == 0))
|
||||
{
|
||||
printf ("\33]0;%s\7", title);
|
||||
}
|
||||
else if (strcmp (envterm, "screen") == 0)
|
||||
{
|
||||
printf ("\033k%s\033\\", title);
|
||||
/* tryning to set the title of a backgrounded xterm like terminal */
|
||||
printf ("\33]0;%s\7", title);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (strcmp (envterm, "sun-cmd") == 0)
|
||||
{
|
||||
printf ("\033]l%s\033\\", "Terminal");
|
||||
}
|
||||
else if (strcmp (envterm, "hpterm") == 0)
|
||||
{
|
||||
printf ("\033&f0k%dD%s", (int)strlen("Terminal"), "Terminal");
|
||||
}
|
||||
/* the following term supports the xterm excapes */
|
||||
else if ((strncmp (envterm, "xterm", 5) == 0)
|
||||
|| (strncmp (envterm, "rxvt", 4) == 0)
|
||||
|| (strcmp (envterm, "Eterm") == 0)
|
||||
|| (strcmp( envterm, "aixterm") == 0)
|
||||
|| (strcmp( envterm, "iris-ansi") == 0)
|
||||
|| (strcmp( envterm, "dtterm") == 0))
|
||||
{
|
||||
printf ("\33]0;%s\7", "Terminal");
|
||||
}
|
||||
else if (strcmp (envterm, "screen") == 0)
|
||||
{
|
||||
if (envshell)
|
||||
{
|
||||
shell = strdup (envshell);
|
||||
if (shell)
|
||||
{
|
||||
shellname = basename (shell);
|
||||
printf ("\033k%s\033\\", (shellname) ? shellname : shell);
|
||||
free (shell);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf ("\033k%s\033\\", envterm);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
printf ("\033k%s\033\\", envterm);
|
||||
}
|
||||
/* tryning to reset the title of a backgrounded xterm like terminal */
|
||||
printf ("\33]0;%s\7", "Terminal");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -83,7 +83,6 @@ extern void gui_window_set_custom_color_fg_bg (WINDOW *window, int fg, int bg);
|
||||
extern void gui_window_set_custom_color_fg (WINDOW *window, int fg);
|
||||
extern void gui_window_set_custom_color_bg (WINDOW *window, int bg);
|
||||
extern void gui_window_clrtoeol_with_current_bg (WINDOW *window);
|
||||
extern void gui_window_title_set ();
|
||||
extern void gui_window_title_reset ();
|
||||
extern void gui_window_set_title (const char *title);
|
||||
|
||||
#endif /* gui-curses.h */
|
||||
|
||||
@@ -192,7 +192,7 @@ gui_main_init ()
|
||||
gui_current_window = gui_windows;
|
||||
|
||||
if (CONFIG_BOOLEAN(config_look_set_title))
|
||||
gui_window_title_set ();
|
||||
gui_window_set_title (PACKAGE_NAME " " PACKAGE_VERSION);
|
||||
}
|
||||
|
||||
/* create bar windows for root bars (they were read from config,
|
||||
@@ -270,7 +270,7 @@ gui_main_end (int clean_exit)
|
||||
|
||||
/* reset title */
|
||||
if (CONFIG_BOOLEAN(config_look_set_title))
|
||||
gui_window_title_reset ();
|
||||
gui_window_set_title (NULL);
|
||||
|
||||
/* end color */
|
||||
gui_color_end ();
|
||||
|
||||
@@ -786,25 +786,17 @@ gui_window_refresh_screen (int full_refresh)
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_window_title_set: set terminal title
|
||||
* gui_window_set_title: set terminal title
|
||||
*/
|
||||
|
||||
void
|
||||
gui_window_title_set ()
|
||||
gui_window_set_title (const char *title)
|
||||
{
|
||||
(void) title;
|
||||
|
||||
/* TODO: write this function for Gtk */
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_window_title_reset: reset terminal title
|
||||
*/
|
||||
|
||||
void
|
||||
gui_window_title_reset ()
|
||||
{
|
||||
/* This function does nothing in Gtk GUI */
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_window_objects_print_log: print Gtk objects infos in log
|
||||
* (usually for crash dump)
|
||||
|
||||
@@ -103,7 +103,6 @@ extern void gui_keyboard_flush ();
|
||||
|
||||
/* window functions */
|
||||
extern void gui_window_redraw_buffer (struct t_gui_buffer *buffer);
|
||||
extern void gui_window_title_set ();
|
||||
extern void gui_window_title_reset ();
|
||||
extern void gui_window_set_title (const char *title);
|
||||
|
||||
#endif /* gui-gtk.h */
|
||||
|
||||
@@ -171,8 +171,7 @@ extern void gui_window_switch_down (struct t_gui_window *window);
|
||||
extern void gui_window_switch_left (struct t_gui_window *window);
|
||||
extern void gui_window_switch_right (struct t_gui_window *window);
|
||||
extern void gui_window_refresh_screen (int full_refresh);
|
||||
extern void gui_window_title_set ();
|
||||
extern void gui_window_title_reset ();
|
||||
extern void gui_window_set_title (const char *title);
|
||||
extern void gui_window_objects_print_log (struct t_gui_window *window);
|
||||
|
||||
#endif /* gui-window.h */
|
||||
|
||||
@@ -527,6 +527,7 @@ plugin_load (const char *filename)
|
||||
new_plugin->window_get_integer = &gui_window_get_integer;
|
||||
new_plugin->window_get_string = &gui_window_get_string;
|
||||
new_plugin->window_get_pointer = &gui_window_get_pointer;
|
||||
new_plugin->window_set_title = &gui_window_set_title;
|
||||
|
||||
new_plugin->nicklist_add_group = &gui_nicklist_add_group;
|
||||
new_plugin->nicklist_search_group = &gui_nicklist_search_group;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -33,7 +33,7 @@ struct t_infolist;
|
||||
struct t_weelist;
|
||||
|
||||
/* API version (used to check that plugin has same API and can be loaded) */
|
||||
#define WEECHAT_PLUGIN_API_VERSION "20090502-01"
|
||||
#define WEECHAT_PLUGIN_API_VERSION "20090510-01"
|
||||
|
||||
/* macros for defining plugin infos */
|
||||
#define WEECHAT_PLUGIN_NAME(__name) \
|
||||
@@ -506,6 +506,7 @@ struct t_weechat_plugin
|
||||
const char *property);
|
||||
void *(*window_get_pointer) (struct t_gui_window *window,
|
||||
const char *property);
|
||||
void (*window_set_title) (const char *title);
|
||||
|
||||
/* nicklist */
|
||||
struct t_gui_nick_group *(*nicklist_add_group) (struct t_gui_buffer *buffer,
|
||||
@@ -1046,6 +1047,8 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
|
||||
weechat_plugin->window_get_pointer(__window, __property)
|
||||
#define weechat_current_window() \
|
||||
weechat_plugin->window_get_pointer(NULL, "current")
|
||||
#define weechat_window_set_title(__title) \
|
||||
weechat_plugin->window_set_title(__title)
|
||||
|
||||
/* nicklist */
|
||||
#define weechat_nicklist_add_group(__buffer, __parent_group, __name, \
|
||||
|
||||
Reference in New Issue
Block a user