mirror of
https://github.com/weechat/weechat.git
synced 2026-06-28 22:06:38 +02:00
script: remove spaces before/after tags displayed on detail of script
This commit is contained in:
@@ -428,27 +428,11 @@ script_buffer_display_detail_script (struct t_repo_script *script)
|
||||
else
|
||||
{
|
||||
weechat_printf_y (script_buffer, line + 1,
|
||||
"%s: %s%s (%s%s%s%s%s%s%s%s%s%s%s%s )",
|
||||
"%s: %s%s (%s)",
|
||||
script_buffer_detail_label (_(labels[line]), max_length),
|
||||
script_repo_get_status_for_display (script, "*iaHrN", 1),
|
||||
weechat_color ("chat"),
|
||||
(script->popularity > 0) ? " " : "",
|
||||
(script->popularity > 0) ? _("popular") : "",
|
||||
(script->status & SCRIPT_STATUS_INSTALLED) ? " " : "",
|
||||
/* TRANSLATORS: translation must be one short word without spaces (replace spaces by underscores if needed) */
|
||||
(script->status & SCRIPT_STATUS_INSTALLED) ? _("installed") : "",
|
||||
(script->status & SCRIPT_STATUS_AUTOLOADED) ? " " : "",
|
||||
/* TRANSLATORS: translation must be one short word without spaces (replace spaces by underscores if needed) */
|
||||
(script->status & SCRIPT_STATUS_AUTOLOADED) ? _("autoloaded") : "",
|
||||
(script->status & SCRIPT_STATUS_HELD) ? " " : "",
|
||||
/* TRANSLATORS: translation must be one short word without spaces (replace spaces by underscores if needed) */
|
||||
(script->status & SCRIPT_STATUS_HELD) ? _("held") : "",
|
||||
(script->status & SCRIPT_STATUS_RUNNING) ? " " : "",
|
||||
/* TRANSLATORS: translation must be one short word without spaces (replace spaces by underscores if needed) */
|
||||
(script->status & SCRIPT_STATUS_RUNNING) ? _("running") : "",
|
||||
(script->status & SCRIPT_STATUS_NEW_VERSION) ? " " : "",
|
||||
/* TRANSLATORS: translation must be one short word without spaces (replace spaces by underscores if needed) */
|
||||
(script->status & SCRIPT_STATUS_NEW_VERSION) ? _("obsolete") : "");
|
||||
script_repo_get_status_desc_for_display (script, "*iaHrN"));
|
||||
}
|
||||
line++;
|
||||
tm = localtime (&script->date_added);
|
||||
|
||||
@@ -204,6 +204,88 @@ script_repo_get_status_for_display (struct t_repo_script *script,
|
||||
return str_status;
|
||||
}
|
||||
|
||||
/*
|
||||
* script_repo_get_status_desc_for_display: get status description for display
|
||||
* (exemple of string returned:
|
||||
* "popular installed autoloaded loaded")
|
||||
*/
|
||||
|
||||
const char *
|
||||
script_repo_get_status_desc_for_display (struct t_repo_script *script,
|
||||
const char *list)
|
||||
{
|
||||
static char str_status[256];
|
||||
const char *ptr_list;
|
||||
|
||||
str_status[0] = '\0';
|
||||
|
||||
if (!script)
|
||||
return str_status;
|
||||
|
||||
for (ptr_list = list; ptr_list[0]; ptr_list++)
|
||||
{
|
||||
switch (ptr_list[0])
|
||||
{
|
||||
case '*':
|
||||
if (script->popularity > 0)
|
||||
{
|
||||
if (str_status[0])
|
||||
strcat (str_status, " ");
|
||||
/* TRANSLATORS: translation must be one short word without spaces (replace spaces by underscores if needed) */
|
||||
strcat (str_status, _("popular"));
|
||||
}
|
||||
break;
|
||||
case 'i':
|
||||
if (script->status & SCRIPT_STATUS_INSTALLED)
|
||||
{
|
||||
if (str_status[0])
|
||||
strcat (str_status, " ");
|
||||
/* TRANSLATORS: translation must be one short word without spaces (replace spaces by underscores if needed) */
|
||||
strcat (str_status, _("installed"));
|
||||
}
|
||||
break;
|
||||
case 'a':
|
||||
if (script->status & SCRIPT_STATUS_AUTOLOADED)
|
||||
{
|
||||
if (str_status[0])
|
||||
strcat (str_status, " ");
|
||||
/* TRANSLATORS: translation must be one short word without spaces (replace spaces by underscores if needed) */
|
||||
strcat (str_status, _("autoloaded"));
|
||||
}
|
||||
break;
|
||||
case 'H':
|
||||
if (script->status & SCRIPT_STATUS_HELD)
|
||||
{
|
||||
if (str_status[0])
|
||||
strcat (str_status, " ");
|
||||
/* TRANSLATORS: translation must be one short word without spaces (replace spaces by underscores if needed) */
|
||||
strcat (str_status, _("held"));
|
||||
}
|
||||
break;
|
||||
case 'r':
|
||||
if (script->status & SCRIPT_STATUS_RUNNING)
|
||||
{
|
||||
if (str_status[0])
|
||||
strcat (str_status, " ");
|
||||
/* TRANSLATORS: translation must be one short word without spaces (replace spaces by underscores if needed) */
|
||||
strcat (str_status, _("running"));
|
||||
}
|
||||
break;
|
||||
case 'N':
|
||||
if (script->status & SCRIPT_STATUS_NEW_VERSION)
|
||||
{
|
||||
if (str_status[0])
|
||||
strcat (str_status, " ");
|
||||
/* TRANSLATORS: translation must be one short word without spaces (replace spaces by underscores if needed) */
|
||||
strcat (str_status, _("obsolete"));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return str_status;
|
||||
}
|
||||
|
||||
/*
|
||||
* script_repo_alloc: allocate a script structure
|
||||
*/
|
||||
|
||||
@@ -67,6 +67,8 @@ extern struct t_repo_script *script_repo_search_by_name_ext (const char *name_wi
|
||||
extern const char *script_repo_get_status_for_display (struct t_repo_script *script,
|
||||
const char *list,
|
||||
int collapse);
|
||||
extern const char *script_repo_get_status_desc_for_display (struct t_repo_script *script,
|
||||
const char *list);
|
||||
extern void script_repo_remove_all ();
|
||||
extern void script_repo_update_status (struct t_repo_script *script);
|
||||
extern void script_repo_update_status_all ();
|
||||
|
||||
Reference in New Issue
Block a user