mirror of
https://github.com/weechat/weechat.git
synced 2026-06-28 13:56:37 +02:00
Add "default" option to command /bar, to create default bars (today only input and status)
This commit is contained in:
@@ -6,7 +6,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: WeeChat 0.2.7-dev\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2008-06-27 17:04+0200\n"
|
||||
"POT-Creation-Date: 2008-06-28 12:09+0200\n"
|
||||
"PO-Revision-Date: 2007-09-06 12:44+0200\n"
|
||||
"Last-Translator: Jiri Golembiovsky <golemj@gmail.com>\n"
|
||||
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
|
||||
@@ -575,8 +575,9 @@ msgstr "řídit buffery"
|
||||
|
||||
msgid ""
|
||||
"[add barname type[,cond1,cond2,...] position size separator item1,item2,...] "
|
||||
"| [del barname] | [set barname name|priority|condition|position|filling|size|"
|
||||
"separator|items value] | [hide|show barname] | [list] | [listitems]"
|
||||
"| [default] | [del barname] | [set barname name|priority|condition|position|"
|
||||
"filling|size|separator|items value] | [hide|show barname] | [list] | "
|
||||
"[listitems]"
|
||||
msgstr ""
|
||||
|
||||
msgid ""
|
||||
@@ -594,6 +595,7 @@ msgid ""
|
||||
" size: size of bar (in chars)\n"
|
||||
"separator: 1 for using separator (line), 0 or nothing means no separator\n"
|
||||
"item1,...: items for this bar\n"
|
||||
" default: create default bars\n"
|
||||
" del: delete a bar\n"
|
||||
" set: set a value for a bar property\n"
|
||||
" hide: hide a bar\n"
|
||||
|
||||
@@ -9,7 +9,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: WeeChat 0.2.7-dev\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2008-06-27 17:04+0200\n"
|
||||
"POT-Creation-Date: 2008-06-28 12:09+0200\n"
|
||||
"PO-Revision-Date: 2007-09-06 12:44+0200\n"
|
||||
"Last-Translator: Thomas Schuetz <i18n@internet-villa.de>\n"
|
||||
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
|
||||
@@ -583,8 +583,9 @@ msgstr "Puffer verwalten"
|
||||
|
||||
msgid ""
|
||||
"[add barname type[,cond1,cond2,...] position size separator item1,item2,...] "
|
||||
"| [del barname] | [set barname name|priority|condition|position|filling|size|"
|
||||
"separator|items value] | [hide|show barname] | [list] | [listitems]"
|
||||
"| [default] | [del barname] | [set barname name|priority|condition|position|"
|
||||
"filling|size|separator|items value] | [hide|show barname] | [list] | "
|
||||
"[listitems]"
|
||||
msgstr ""
|
||||
|
||||
msgid ""
|
||||
@@ -602,6 +603,7 @@ msgid ""
|
||||
" size: size of bar (in chars)\n"
|
||||
"separator: 1 for using separator (line), 0 or nothing means no separator\n"
|
||||
"item1,...: items for this bar\n"
|
||||
" default: create default bars\n"
|
||||
" del: delete a bar\n"
|
||||
" set: set a value for a bar property\n"
|
||||
" hide: hide a bar\n"
|
||||
|
||||
@@ -6,7 +6,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: WeeChat 0.2.7-dev\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2008-06-27 17:04+0200\n"
|
||||
"POT-Creation-Date: 2008-06-28 12:09+0200\n"
|
||||
"PO-Revision-Date: 2007-09-19 12:09+0200\n"
|
||||
"Last-Translator: Roberto González Cardenete <robert.glez@gmail.com>\n"
|
||||
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
|
||||
@@ -579,8 +579,9 @@ msgstr "gestionar los búfers"
|
||||
|
||||
msgid ""
|
||||
"[add barname type[,cond1,cond2,...] position size separator item1,item2,...] "
|
||||
"| [del barname] | [set barname name|priority|condition|position|filling|size|"
|
||||
"separator|items value] | [hide|show barname] | [list] | [listitems]"
|
||||
"| [default] | [del barname] | [set barname name|priority|condition|position|"
|
||||
"filling|size|separator|items value] | [hide|show barname] | [list] | "
|
||||
"[listitems]"
|
||||
msgstr ""
|
||||
|
||||
msgid ""
|
||||
@@ -598,6 +599,7 @@ msgid ""
|
||||
" size: size of bar (in chars)\n"
|
||||
"separator: 1 for using separator (line), 0 or nothing means no separator\n"
|
||||
"item1,...: items for this bar\n"
|
||||
" default: create default bars\n"
|
||||
" del: delete a bar\n"
|
||||
" set: set a value for a bar property\n"
|
||||
" hide: hide a bar\n"
|
||||
|
||||
@@ -6,8 +6,8 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: WeeChat 0.2.7-dev\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2008-06-27 17:04+0200\n"
|
||||
"PO-Revision-Date: 2008-06-27 17:06+0200\n"
|
||||
"POT-Creation-Date: 2008-06-28 12:09+0200\n"
|
||||
"PO-Revision-Date: 2008-06-28 12:11+0200\n"
|
||||
"Last-Translator: FlashCode <flashcode@flashtux.org>\n"
|
||||
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
@@ -534,13 +534,10 @@ msgstr "gestion des barres"
|
||||
|
||||
msgid ""
|
||||
"[add barname type[,cond1,cond2,...] position size separator item1,item2,...] "
|
||||
"| [del barname] | [set barname name|priority|condition|position|filling|size|"
|
||||
"separator|items value] | [hide|show barname] | [list] | [listitems]"
|
||||
msgstr ""
|
||||
"[add nombarre type[,cond1,cond2,...] position taille separateur objet1,"
|
||||
"objet2,...] | [del nombarre] | [set nombarre name|priority|condition|"
|
||||
"position|filling|size|separator|items valeur] | [hide|show nombarre] | "
|
||||
"[list] | [listitems]"
|
||||
"| [default] | [del barname] | [set barname name|priority|condition|position|"
|
||||
"filling|size|separator|items value] | [hide|show barname] | [list] | "
|
||||
"[listitems]"
|
||||
msgstr "[add nombarre type[,cond1,cond2,...] position taille separateur objet1,objet2,...] | [default] | [del nombarre] | [set nombarre name|priority|condition|position|filling|size|separator|items valeur] | [hide|show nombarre] | [list] | [listitems]"
|
||||
|
||||
msgid ""
|
||||
" add: add a new bar\n"
|
||||
@@ -557,6 +554,7 @@ msgid ""
|
||||
" size: size of bar (in chars)\n"
|
||||
"separator: 1 for using separator (line), 0 or nothing means no separator\n"
|
||||
"item1,...: items for this bar\n"
|
||||
" default: create default bars\n"
|
||||
" del: delete a bar\n"
|
||||
" set: set a value for a bar property\n"
|
||||
" hide: hide a bar\n"
|
||||
@@ -579,6 +577,7 @@ msgstr ""
|
||||
" taille: taille de la barre (en caractères)\n"
|
||||
"separateur: 1 pour utiliser un séparateur (ligne), 0 ou rien signifie sans séparateur\n"
|
||||
"objet1,...: objets pour cette barre\n"
|
||||
" default: créer les barres par défaut\n"
|
||||
" del: supprime une barre\n"
|
||||
" set: changer la valeur d'une propriété de la barre\n"
|
||||
" hide: cacher la barre\n"
|
||||
@@ -780,8 +779,10 @@ msgstr ""
|
||||
" list: lister les extensions chargées\n"
|
||||
"listfull: lister les extensions chargées (verbeux)\n"
|
||||
" load: charger une extension\n"
|
||||
"autoload: charger automatiquement les extensions dans un répertoire système ou utilisateur\n"
|
||||
" reload: recharger une extension (si pas de nom donné, décharger toutes les extensions, puis puis recharger automatiquement les extensions)\n"
|
||||
"autoload: charger automatiquement les extensions dans un répertoire système "
|
||||
"ou utilisateur\n"
|
||||
" reload: recharger une extension (si pas de nom donné, décharger toutes les "
|
||||
"extensions, puis puis recharger automatiquement les extensions)\n"
|
||||
" unload: décharger une ou plusieurs exteneions\n"
|
||||
"\n"
|
||||
"Sans paramètre, la commande /plugin liste les extensions chargées."
|
||||
|
||||
@@ -12,7 +12,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: WeeChat 0.2.7-dev\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2008-06-27 17:04+0200\n"
|
||||
"POT-Creation-Date: 2008-06-28 12:09+0200\n"
|
||||
"PO-Revision-Date: 2007-10-10 18:07+0200\n"
|
||||
"Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n"
|
||||
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
|
||||
@@ -583,8 +583,9 @@ msgstr "pufferek kezelése"
|
||||
|
||||
msgid ""
|
||||
"[add barname type[,cond1,cond2,...] position size separator item1,item2,...] "
|
||||
"| [del barname] | [set barname name|priority|condition|position|filling|size|"
|
||||
"separator|items value] | [hide|show barname] | [list] | [listitems]"
|
||||
"| [default] | [del barname] | [set barname name|priority|condition|position|"
|
||||
"filling|size|separator|items value] | [hide|show barname] | [list] | "
|
||||
"[listitems]"
|
||||
msgstr ""
|
||||
|
||||
msgid ""
|
||||
@@ -602,6 +603,7 @@ msgid ""
|
||||
" size: size of bar (in chars)\n"
|
||||
"separator: 1 for using separator (line), 0 or nothing means no separator\n"
|
||||
"item1,...: items for this bar\n"
|
||||
" default: create default bars\n"
|
||||
" del: delete a bar\n"
|
||||
" set: set a value for a bar property\n"
|
||||
" hide: hide a bar\n"
|
||||
|
||||
@@ -6,7 +6,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: WeeChat 0.2.7-dev\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2008-06-27 17:04+0200\n"
|
||||
"POT-Creation-Date: 2008-06-28 12:09+0200\n"
|
||||
"PO-Revision-Date: 2007-09-06 12:44+0200\n"
|
||||
"Last-Translator: Pavel Shevchuk <stlwrt@gmail.com>\n"
|
||||
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
|
||||
@@ -577,8 +577,9 @@ msgstr "управление буферами"
|
||||
|
||||
msgid ""
|
||||
"[add barname type[,cond1,cond2,...] position size separator item1,item2,...] "
|
||||
"| [del barname] | [set barname name|priority|condition|position|filling|size|"
|
||||
"separator|items value] | [hide|show barname] | [list] | [listitems]"
|
||||
"| [default] | [del barname] | [set barname name|priority|condition|position|"
|
||||
"filling|size|separator|items value] | [hide|show barname] | [list] | "
|
||||
"[listitems]"
|
||||
msgstr ""
|
||||
|
||||
msgid ""
|
||||
@@ -596,6 +597,7 @@ msgid ""
|
||||
" size: size of bar (in chars)\n"
|
||||
"separator: 1 for using separator (line), 0 or nothing means no separator\n"
|
||||
"item1,...: items for this bar\n"
|
||||
" default: create default bars\n"
|
||||
" del: delete a bar\n"
|
||||
" set: set a value for a bar property\n"
|
||||
" hide: hide a bar\n"
|
||||
|
||||
+5
-3
@@ -7,7 +7,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2008-06-27 17:04+0200\n"
|
||||
"POT-Creation-Date: 2008-06-28 12:09+0200\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
@@ -509,8 +509,9 @@ msgstr ""
|
||||
|
||||
msgid ""
|
||||
"[add barname type[,cond1,cond2,...] position size separator item1,item2,...] "
|
||||
"| [del barname] | [set barname name|priority|condition|position|filling|size|"
|
||||
"separator|items value] | [hide|show barname] | [list] | [listitems]"
|
||||
"| [default] | [del barname] | [set barname name|priority|condition|position|"
|
||||
"filling|size|separator|items value] | [hide|show barname] | [list] | "
|
||||
"[listitems]"
|
||||
msgstr ""
|
||||
|
||||
msgid ""
|
||||
@@ -528,6 +529,7 @@ msgid ""
|
||||
" size: size of bar (in chars)\n"
|
||||
"separator: 1 for using separator (line), 0 or nothing means no separator\n"
|
||||
"item1,...: items for this bar\n"
|
||||
" default: create default bars\n"
|
||||
" del: delete a bar\n"
|
||||
" set: set a value for a bar property\n"
|
||||
" hide: hide a bar\n"
|
||||
|
||||
+13
-5
@@ -277,6 +277,13 @@ command_bar (void *data, struct t_gui_buffer *buffer,
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
/* create default bars */
|
||||
if (string_strcasecmp (argv[1], "default") == 0)
|
||||
{
|
||||
gui_bar_create_default ();
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
/* delete a bar */
|
||||
if (string_strcasecmp (argv[1], "del") == 0)
|
||||
{
|
||||
@@ -2647,10 +2654,10 @@ command_init ()
|
||||
hook_command (NULL, "bar",
|
||||
N_("manage bars"),
|
||||
N_("[add barname type[,cond1,cond2,...] position size "
|
||||
"separator item1,item2,...] | [del barname] | "
|
||||
"[set barname name|priority|condition|position|filling|"
|
||||
"size|separator|items value] | [hide|show barname] | "
|
||||
"[list] | [listitems]"),
|
||||
"separator item1,item2,...] | [default] | "
|
||||
"[del barname] | [set barname name|priority|condition|"
|
||||
"position|filling|size|separator|items value] | "
|
||||
"[hide|show barname] | [list] | [listitems]"),
|
||||
N_(" add: add a new bar\n"
|
||||
" barname: name of bar (must be unique)\n"
|
||||
" type: root: outside windows),\n"
|
||||
@@ -2668,6 +2675,7 @@ command_init ()
|
||||
"separator: 1 for using separator (line), 0 or nothing "
|
||||
"means no separator\n"
|
||||
"item1,...: items for this bar\n"
|
||||
" default: create default bars\n"
|
||||
" del: delete a bar\n"
|
||||
" set: set a value for a bar property\n"
|
||||
" hide: hide a bar\n"
|
||||
@@ -2675,7 +2683,7 @@ command_init ()
|
||||
" list: list all bars\n"
|
||||
" listfull: list all bars (verbose)\n"
|
||||
"listitems: list all bar items"),
|
||||
"add|del|set|hide|show|list|listfull|listitems %r "
|
||||
"add|default|del|set|hide|show|list|listfull|listitems %r "
|
||||
"name|priority|conditions|position|filling|size|separator|"
|
||||
"items",
|
||||
&command_bar, NULL);
|
||||
|
||||
@@ -471,6 +471,7 @@ config_weechat_reload (void *data, struct t_config_file *config_file)
|
||||
if (rc == WEECHAT_CONFIG_READ_OK)
|
||||
{
|
||||
gui_bar_use_temp_bars ();
|
||||
//gui_bar_create_default ();
|
||||
}
|
||||
|
||||
return rc;
|
||||
@@ -1590,6 +1591,7 @@ config_weechat_read ()
|
||||
{
|
||||
config_change_day_change (NULL, NULL);
|
||||
gui_bar_use_temp_bars ();
|
||||
//gui_bar_create_default ();
|
||||
}
|
||||
|
||||
return rc;
|
||||
|
||||
+72
-34
@@ -61,16 +61,16 @@ struct t_hook *gui_bar_item_timer = NULL;
|
||||
*/
|
||||
|
||||
struct t_gui_bar_item *
|
||||
gui_bar_item_search (const char *name)
|
||||
gui_bar_item_search (const char *item_name)
|
||||
{
|
||||
struct t_gui_bar_item *ptr_item;
|
||||
|
||||
if (!name || !name[0])
|
||||
if (!item_name || !item_name[0])
|
||||
return NULL;
|
||||
|
||||
for (ptr_item = gui_bar_items; ptr_item; ptr_item = ptr_item->next_item)
|
||||
{
|
||||
if (strcmp (ptr_item->name, name) == 0)
|
||||
if (strcmp (ptr_item->name, item_name) == 0)
|
||||
return ptr_item;
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ gui_bar_item_string_get_item_start (const char *string)
|
||||
*/
|
||||
|
||||
int
|
||||
gui_bar_item_string_is_item (const char *string, const char *name)
|
||||
gui_bar_item_string_is_item (const char *string, const char *item_name)
|
||||
{
|
||||
const char *item_start;
|
||||
int length;
|
||||
@@ -132,8 +132,8 @@ gui_bar_item_string_is_item (const char *string, const char *name)
|
||||
if (!item_start)
|
||||
return 0;
|
||||
|
||||
length = strlen (name);
|
||||
if (strncmp (item_start, name, length) == 0)
|
||||
length = strlen (item_name);
|
||||
if (strncmp (item_start, item_name, length) == 0)
|
||||
{
|
||||
if (!gui_bar_item_valid_char_name (item_start[length]))
|
||||
return 1;
|
||||
@@ -147,17 +147,18 @@ gui_bar_item_string_is_item (const char *string, const char *name)
|
||||
*/
|
||||
|
||||
struct t_gui_bar_item *
|
||||
gui_bar_item_search_with_plugin (struct t_weechat_plugin *plugin, const char *name)
|
||||
gui_bar_item_search_with_plugin (struct t_weechat_plugin *plugin,
|
||||
const char *item_name)
|
||||
{
|
||||
struct t_gui_bar_item *ptr_item;
|
||||
|
||||
if (!name || !name[0])
|
||||
if (!item_name || !item_name[0])
|
||||
return NULL;
|
||||
|
||||
for (ptr_item = gui_bar_items; ptr_item; ptr_item = ptr_item->next_item)
|
||||
{
|
||||
if ((ptr_item->plugin == plugin)
|
||||
&& (strcmp (ptr_item->name, name) == 0))
|
||||
&& (strcmp (ptr_item->name, item_name) == 0))
|
||||
return ptr_item;
|
||||
}
|
||||
|
||||
@@ -165,6 +166,66 @@ gui_bar_item_search_with_plugin (struct t_weechat_plugin *plugin, const char *na
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_bar_contains_item: return 1 if a bar contains item, O otherwise
|
||||
*/
|
||||
|
||||
int
|
||||
gui_bar_contains_item (struct t_gui_bar *bar, const char *item_name)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!bar || !item_name || !item_name[0])
|
||||
return 0;
|
||||
|
||||
for (i = 0; i < bar->items_count; i++)
|
||||
{
|
||||
/* skip non letters chars at beginning (prefix) */
|
||||
if (gui_bar_item_string_is_item (bar->items_array[i], item_name))
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* item is not in bar */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_bar_item_used_in_a_bar: return 1 if an item is used in at least one bar
|
||||
* if partial_name == 1, then search a bar that
|
||||
* contains item beginning with "item_name"
|
||||
*/
|
||||
|
||||
int
|
||||
gui_bar_item_used_in_a_bar (const char *item_name, int partial_name)
|
||||
{
|
||||
struct t_gui_bar *ptr_bar;
|
||||
int i, length;
|
||||
const char *ptr_start;
|
||||
|
||||
length = strlen (item_name);
|
||||
|
||||
for (ptr_bar = gui_bars; ptr_bar; ptr_bar = ptr_bar->next_bar)
|
||||
{
|
||||
for (i = 0; i < ptr_bar->items_count; i++)
|
||||
{
|
||||
ptr_start = gui_bar_item_string_get_item_start (ptr_bar->items_array[i]);
|
||||
if (ptr_start)
|
||||
{
|
||||
if ((partial_name
|
||||
&& strncmp (ptr_start, item_name, length) == 0)
|
||||
|| (!partial_name
|
||||
&& strcmp (ptr_start, item_name) == 0))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* item not used by any bar */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_bar_item_input_text_update_for_display: update input text item for
|
||||
* display:
|
||||
@@ -456,42 +517,19 @@ gui_bar_item_new (struct t_weechat_plugin *plugin, const char *name,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_bar_contains_item: return 1 if a bar contains item, O otherwise
|
||||
*/
|
||||
|
||||
int
|
||||
gui_bar_contains_item (struct t_gui_bar *bar, const char *name)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!bar || !name || !name[0])
|
||||
return 0;
|
||||
|
||||
for (i = 0; i < bar->items_count; i++)
|
||||
{
|
||||
/* skip non letters chars at beginning (prefix) */
|
||||
if (gui_bar_item_string_is_item (bar->items_array[i], name))
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* item is not in bar */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_bar_item_update: update an item on all bars displayed on screen
|
||||
*/
|
||||
|
||||
void
|
||||
gui_bar_item_update (const char *name)
|
||||
gui_bar_item_update (const char *item_name)
|
||||
{
|
||||
struct t_gui_bar *ptr_bar;
|
||||
|
||||
for (ptr_bar = gui_bars; ptr_bar; ptr_bar = ptr_bar->next_bar)
|
||||
{
|
||||
if (!CONFIG_BOOLEAN(ptr_bar->hidden)
|
||||
&& gui_bar_contains_item (ptr_bar, name))
|
||||
&& gui_bar_contains_item (ptr_bar, item_name))
|
||||
{
|
||||
gui_bar_draw (ptr_bar);
|
||||
}
|
||||
|
||||
@@ -68,6 +68,8 @@ extern char *gui_bar_item_names[];
|
||||
/* functions */
|
||||
|
||||
extern struct t_gui_bar_item *gui_bar_item_search (const char *name);
|
||||
extern int gui_bar_item_used_in_a_bar (const char *item_name,
|
||||
int partial_name);
|
||||
extern char *gui_bar_item_get_value (const char *name,
|
||||
struct t_gui_bar *bar,
|
||||
struct t_gui_window *window,
|
||||
@@ -78,7 +80,8 @@ extern struct t_gui_bar_item *gui_bar_item_new (struct t_weechat_plugin *plugin,
|
||||
char *(*build_callback)(void *data,
|
||||
struct t_gui_bar_item *item,
|
||||
struct t_gui_window *window,
|
||||
int max_width, int max_height),
|
||||
int max_width,
|
||||
int max_height),
|
||||
void *build_callback_data);
|
||||
extern void gui_bar_item_update (const char *name);
|
||||
extern void gui_bar_item_free (struct t_gui_bar_item *item);
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include "../core/wee-log.h"
|
||||
#include "../core/wee-string.h"
|
||||
#include "gui-bar.h"
|
||||
#include "gui-bar-item.h"
|
||||
#include "gui-buffer.h"
|
||||
#include "gui-chat.h"
|
||||
#include "gui-color.h"
|
||||
@@ -1555,6 +1556,113 @@ gui_bar_use_temp_bars ()
|
||||
last_gui_temp_bar = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_bar_create_default: create default bars if they do not exist
|
||||
*/
|
||||
|
||||
void
|
||||
gui_bar_create_default ()
|
||||
{
|
||||
struct t_gui_bar *ptr_bar;
|
||||
int length;
|
||||
char *buf;
|
||||
|
||||
/* search an input_text item */
|
||||
if (!gui_bar_item_used_in_a_bar (gui_bar_item_names[GUI_BAR_ITEM_INPUT_TEXT], 1))
|
||||
{
|
||||
ptr_bar = gui_bar_search ("input");
|
||||
if (ptr_bar)
|
||||
{
|
||||
/* add item "input_text" to input bar */
|
||||
length = 1;
|
||||
if (CONFIG_STRING(ptr_bar->items))
|
||||
length += strlen (CONFIG_STRING(ptr_bar->items));
|
||||
length += 1; /* "," */
|
||||
length += strlen (gui_bar_item_names[GUI_BAR_ITEM_INPUT_TEXT]);
|
||||
buf = malloc (length);
|
||||
if (buf)
|
||||
{
|
||||
snprintf (buf, length, "%s,%s",
|
||||
(CONFIG_STRING(ptr_bar->items)) ?
|
||||
CONFIG_STRING(ptr_bar->items) : "",
|
||||
gui_bar_item_names[GUI_BAR_ITEM_INPUT_TEXT]);
|
||||
config_file_option_set (ptr_bar->items, buf, 1);
|
||||
gui_bar_draw (ptr_bar);
|
||||
free (buf);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* create input bar */
|
||||
length = 1 /* "[" */
|
||||
+ strlen (gui_bar_item_names[GUI_BAR_ITEM_INPUT_PROMPT])
|
||||
+ 2 /* "]," */
|
||||
+ strlen (gui_bar_item_names[GUI_BAR_ITEM_INPUT_TEXT])
|
||||
+ 1 /* \0 */;
|
||||
buf = malloc (length);
|
||||
if (buf)
|
||||
{
|
||||
snprintf (buf, length, "[%s],%s",
|
||||
gui_bar_item_names[GUI_BAR_ITEM_INPUT_PROMPT],
|
||||
gui_bar_item_names[GUI_BAR_ITEM_INPUT_TEXT]);
|
||||
if (gui_bar_new (NULL, "input", "0", "999", "window", "",
|
||||
"bottom", "horizontal", "1", "0",
|
||||
gui_color_get_name (CONFIG_COLOR(config_color_input)),
|
||||
gui_color_get_name (CONFIG_COLOR(config_color_input_delimiters)),
|
||||
gui_color_get_name (CONFIG_COLOR(config_color_input_bg)),
|
||||
"0", buf))
|
||||
{
|
||||
gui_chat_printf (NULL, _("Bar \"%s\" created"),
|
||||
"input");
|
||||
}
|
||||
free (buf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* search status bar */
|
||||
ptr_bar = gui_bar_search ("status");
|
||||
if (!ptr_bar)
|
||||
{
|
||||
/* create status bar */
|
||||
length = strlen (gui_bar_item_names[GUI_BAR_ITEM_TIME])
|
||||
+ strlen (gui_bar_item_names[GUI_BAR_ITEM_BUFFER_COUNT])
|
||||
+ strlen (gui_bar_item_names[GUI_BAR_ITEM_BUFFER_PLUGIN])
|
||||
+ strlen (gui_bar_item_names[GUI_BAR_ITEM_BUFFER_NAME])
|
||||
+ strlen (gui_bar_item_names[GUI_BAR_ITEM_HOTLIST])
|
||||
+ strlen (gui_bar_item_names[GUI_BAR_ITEM_BUFFER_FILTER])
|
||||
+ strlen (gui_bar_item_names[GUI_BAR_ITEM_COMPLETION])
|
||||
+ strlen (gui_bar_item_names[GUI_BAR_ITEM_SCROLL])
|
||||
+ strlen (gui_bar_item_names[GUI_BAR_ITEM_NICKLIST_COUNT])
|
||||
+ (9 * 4) + 1;
|
||||
buf = malloc (length);
|
||||
if (buf)
|
||||
{
|
||||
snprintf (buf, length, "[%s],[%s],[%s],%s,(%s),[%s],[%s],%s,%s",
|
||||
gui_bar_item_names[GUI_BAR_ITEM_TIME],
|
||||
gui_bar_item_names[GUI_BAR_ITEM_BUFFER_COUNT],
|
||||
gui_bar_item_names[GUI_BAR_ITEM_BUFFER_PLUGIN],
|
||||
gui_bar_item_names[GUI_BAR_ITEM_BUFFER_NAME],
|
||||
gui_bar_item_names[GUI_BAR_ITEM_NICKLIST_COUNT],
|
||||
gui_bar_item_names[GUI_BAR_ITEM_HOTLIST],
|
||||
gui_bar_item_names[GUI_BAR_ITEM_BUFFER_FILTER],
|
||||
gui_bar_item_names[GUI_BAR_ITEM_COMPLETION],
|
||||
gui_bar_item_names[GUI_BAR_ITEM_SCROLL]);
|
||||
if (gui_bar_new (NULL, "status", "0", "0", "window", "",
|
||||
"bottom", "horizontal", "1", "0",
|
||||
gui_color_get_name (CONFIG_COLOR(config_color_status)),
|
||||
gui_color_get_name (CONFIG_COLOR(config_color_status_delimiters)),
|
||||
gui_color_get_name (CONFIG_COLOR(config_color_status_bg)),
|
||||
"0", buf))
|
||||
{
|
||||
gui_chat_printf (NULL, _("Bar \"%s\" created"),
|
||||
"input");
|
||||
}
|
||||
free (buf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_bar_update: update a bar on screen
|
||||
*/
|
||||
|
||||
@@ -135,6 +135,7 @@ extern struct t_gui_bar *gui_bar_new (struct t_weechat_plugin *plugin,
|
||||
const char *separator,
|
||||
const char *items);
|
||||
extern void gui_bar_use_temp_bars ();
|
||||
extern void gui_bar_create_default ();
|
||||
extern void gui_bar_update (const char *name);
|
||||
extern void gui_bar_free (struct t_gui_bar *bar);
|
||||
extern void gui_bar_free_all ();
|
||||
|
||||
@@ -33,15 +33,27 @@
|
||||
#include <ctype.h>
|
||||
|
||||
#include "../core/weechat.h"
|
||||
#include "../core/wee-hook.h"
|
||||
#include "../core/wee-log.h"
|
||||
#include "../core/wee-string.h"
|
||||
#include "../core/wee-utf8.h"
|
||||
#include "../plugins/plugin.h"
|
||||
#include "gui-nicklist.h"
|
||||
#include "gui-buffer.h"
|
||||
#include "gui-color.h"
|
||||
#include "gui-status.h"
|
||||
|
||||
|
||||
/*
|
||||
* gui_nicklist_changed_signal: send "nicklist_changed" signal
|
||||
*/
|
||||
|
||||
void
|
||||
gui_nicklist_changed_signal ()
|
||||
{
|
||||
hook_signal_send ("nicklist_changed", WEECHAT_HOOK_SIGNAL_STRING, NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_nicklist_find_pos_group: find position for a group (for sorting nicklist)
|
||||
*/
|
||||
@@ -200,6 +212,8 @@ gui_nicklist_add_group (struct t_gui_buffer *buffer,
|
||||
gui_status_refresh_needed = 1;
|
||||
}
|
||||
|
||||
gui_nicklist_changed_signal ();
|
||||
|
||||
return new_group;
|
||||
}
|
||||
|
||||
@@ -342,6 +356,8 @@ gui_nicklist_add_nick (struct t_gui_buffer *buffer,
|
||||
gui_status_refresh_needed = 1;
|
||||
}
|
||||
|
||||
gui_nicklist_changed_signal ();
|
||||
|
||||
return new_nick;
|
||||
}
|
||||
|
||||
@@ -379,6 +395,8 @@ gui_nicklist_remove_nick (struct t_gui_buffer *buffer,
|
||||
}
|
||||
|
||||
free (nick);
|
||||
|
||||
gui_nicklist_changed_signal ();
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -435,6 +453,8 @@ gui_nicklist_remove_group (struct t_gui_buffer *buffer,
|
||||
}
|
||||
|
||||
free (group);
|
||||
|
||||
gui_nicklist_changed_signal ();
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user