1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-05 09:13:14 +02:00

core: add /theme rename to rename a user theme file

This commit is contained in:
Sébastien Helleu
2026-07-04 21:40:03 +02:00
parent 08280f472d
commit 356ddaa949
26 changed files with 825 additions and 45 deletions
+13
View File
@@ -2283,6 +2283,19 @@ Reserved names (built-in theme names like `+light+` and any name
starting with `+backup-+`) are refused. Files live at
`+${weechat_config_dir}/themes/<name>.theme+`.
Rename a user theme (typical use: keep a useful automatic backup
under a meaningful name):
----
/theme rename backup-20260525-094210-123456 mybackup
----
Built-in themes have no file and cannot be renamed; the target name
cannot match a built-in name or start with `+backup-+`, and the
target file must not already exist. The `+[info]+` `+name+` field
inside the file is rewritten so `/theme info` reports the new name
consistently.
Delete a user theme:
----
+13
View File
@@ -2270,6 +2270,19 @@ Reserved names (built-in theme names like `+light+` and any name
starting with `+backup-+`) are refused. Files live at
`+${weechat_config_dir}/themes/<name>.theme+`.
Rename a user theme (typical use: keep a useful automatic backup
under a meaningful name):
----
/theme rename backup-20260525-094210-123456 mybackup
----
Built-in themes have no file and cannot be renamed; the target name
cannot match a built-in name or start with `+backup-+`, and the
target file must not already exist. The `+[info]+` `+name+` field
inside the file is rewritten so `/theme info` reports the new name
consistently.
Delete a user theme:
----
+14
View File
@@ -2319,6 +2319,20 @@ Les noms réservés (noms de thèmes intégrés comme `+light+` et tout nom
commençant par `+backup-+`) sont refusés. Les fichiers sont placés
dans `+${weechat_config_dir}/themes/<nom>.theme+`.
Renommer un thème utilisateur (usage typique : conserver une
sauvegarde automatique utile sous un nom plus parlant) :
----
/theme rename backup-20260525-094210-123456 maSauvegarde
----
Les thèmes intégrés n'ont pas de fichier et ne peuvent pas être
renommés ; le nom cible ne peut pas correspondre à un nom intégré ni
commencer par `+backup-+`, et le fichier cible ne doit pas déjà
exister. Le champ `+name+` de la section `+[info]+` à l'intérieur du
fichier est réécrit afin que `/theme info` affiche le nouveau nom de
manière cohérente.
Supprimer un thème utilisateur :
----
+13
View File
@@ -2525,6 +2525,19 @@ Reserved names (built-in theme names like `+light+` and any name
starting with `+backup-+`) are refused. Files live at
`+${weechat_config_dir}/themes/<name>.theme+`.
Rename a user theme (typical use: keep a useful automatic backup
under a meaningful name):
----
/theme rename backup-20260525-094210-123456 mybackup
----
Built-in themes have no file and cannot be renamed; the target name
cannot match a built-in name or start with `+backup-+`, and the
target file must not already exist. The `+[info]+` `+name+` field
inside the file is rewritten so `/theme info` reports the new name
consistently.
Delete a user theme:
----
+13
View File
@@ -2461,6 +2461,19 @@ Reserved names (built-in theme names like `+light+` and any name
starting with `+backup-+`) are refused. Files live at
`+${weechat_config_dir}/themes/<name>.theme+`.
Rename a user theme (typical use: keep a useful automatic backup
under a meaningful name):
----
/theme rename backup-20260525-094210-123456 mybackup
----
Built-in themes have no file and cannot be renamed; the target name
cannot match a built-in name or start with `+backup-+`, and the
target file must not already exist. The `+[info]+` `+name+` field
inside the file is rewritten so `/theme info` reports the new name
consistently.
Delete a user theme:
----
+13
View File
@@ -2277,6 +2277,19 @@ Reserved names (built-in theme names like `+light+` and any name
starting with `+backup-+`) are refused. Files live at
`+${weechat_config_dir}/themes/<name>.theme+`.
Rename a user theme (typical use: keep a useful automatic backup
under a meaningful name):
----
/theme rename backup-20260525-094210-123456 mybackup
----
Built-in themes have no file and cannot be renamed; the target name
cannot match a built-in name or start with `+backup-+`, and the
target file must not already exist. The `+[info]+` `+name+` field
inside the file is rewritten so `/theme info` reports the new name
consistently.
Delete a user theme:
----
+13
View File
@@ -2179,6 +2179,19 @@ Reserved names (built-in theme names like `+light+` and any name
starting with `+backup-+`) are refused. Files live at
`+${weechat_config_dir}/themes/<name>.theme+`.
Rename a user theme (typical use: keep a useful automatic backup
under a meaningful name):
----
/theme rename backup-20260525-094210-123456 mybackup
----
Built-in themes have no file and cannot be renamed; the target name
cannot match a built-in name or start with `+backup-+`, and the
target file must not already exist. The `+[info]+` `+name+` field
inside the file is rewritten so `/theme info` reports the new name
consistently.
Delete a user theme:
----
+31 -3
View File
@@ -23,7 +23,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2026-07-04 21:01+0200\n"
"POT-Creation-Date: 2026-07-04 21:31+0200\n"
"PO-Revision-Date: 2026-05-30 14:01+0200\n"
"Last-Translator: Ondřej Súkup <mimi.vx@gmail.com>\n"
"Language-Team: Czech <weechat-dev@nongnu.org>\n"
@@ -3714,8 +3714,8 @@ msgstr "seznam položek polí"
#. TRANSLATORS: only text between angle brackets (eg: "<name>") may be translated
msgid ""
"[list [-backups]] || apply <name> || reset || save <name> [-full] || del "
"<name> || info <name>"
"[list [-backups]] || apply <name> || reset || save <name> [-full] || rename "
"<old> <new> || del <name> || info <name>"
msgstr ""
#, fuzzy
@@ -3747,6 +3747,11 @@ msgid ""
"match a built-in theme or start with \"backup-\""
msgstr ""
#, fuzzy
#| msgid "names of filters"
msgid "raw[rename]: rename a user theme file"
msgstr "jména filtrů"
#, fuzzy
#| msgid "get/set channel topic"
msgid "raw[del]: delete a user theme file"
@@ -4369,6 +4374,9 @@ msgstr ""
msgid "names of user theme files (without built-ins and backups)"
msgstr ""
msgid "names of theme files on disk (user files + backups, no built-ins)"
msgstr ""
msgid "names of secured data (file sec.conf, section data)"
msgstr "jména chráněných dat (soubor sec.conf, sekce data)"
@@ -6393,6 +6401,26 @@ msgstr "%s%s: nemůžu parsovat soubor \"%s\""
msgid "Theme saved to: %s"
msgstr "Volba \"%s%s%s\":"
#, fuzzy, c-format
msgid "%sCannot rename built-in theme \"%s\""
msgstr "%sChyba: nemohu vytvořit soubor \"%s\""
#, c-format
msgid "%sNew name is the same as old name"
msgstr ""
#, fuzzy, c-format
msgid "%sTheme \"%s\" already exists"
msgstr "%s%s: vzorec přesměrování \"%s\" již existuje"
#, fuzzy, c-format
msgid "%sFailed to rename theme \"%s\" to \"%s\""
msgstr "%sChyba: nemohu přejmenovat filter \"%s\" na \"%s\""
#, fuzzy, c-format
msgid "Theme \"%s\" renamed to \"%s\""
msgstr "Filtr \"%s\" přejmenován na \"%s\""
#, fuzzy, c-format
msgid "%sCannot delete built-in theme \"%s\""
msgstr "%sChyba: nemohu vytvořit soubor \"%s\""
+35 -3
View File
@@ -26,7 +26,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2026-07-04 21:01+0200\n"
"POT-Creation-Date: 2026-07-04 21:31+0200\n"
"PO-Revision-Date: 2026-06-28 08:28+0200\n"
"Last-Translator: Nils Görs <weechatter@arcor.de>\n"
"Language-Team: German <weechatter@arcor.de>\n"
@@ -4106,8 +4106,8 @@ msgstr "Verwalten von benutzerdefinierten Bar-Items"
#. TRANSLATORS: only text between angle brackets (eg: "<name>") may be translated
msgid ""
"[list [-backups]] || apply <name> || reset || save <name> [-full] || del "
"<name> || info <name>"
"[list [-backups]] || apply <name> || reset || save <name> [-full] || rename "
"<old> <new> || del <name> || info <name>"
msgstr ""
#, fuzzy
@@ -4146,6 +4146,11 @@ msgid ""
"match a built-in theme or start with \"backup-\""
msgstr ""
#, fuzzy
#| msgid "raw[rename]: rename a filter"
msgid "raw[rename]: rename a user theme file"
msgstr "raw[rename]: benennt einen Filter um"
#, fuzzy
#| msgid "raw[del]: delete a server"
msgid "raw[del]: delete a user theme file"
@@ -4838,6 +4843,9 @@ msgstr ""
msgid "names of user theme files (without built-ins and backups)"
msgstr ""
msgid "names of theme files on disk (user files + backups, no built-ins)"
msgstr ""
msgid "names of secured data (file sec.conf, section data)"
msgstr "Namen der geschützten Daten (Datei sec.conf, section data)"
@@ -7237,6 +7245,30 @@ msgstr "%s%s: Datei \"%s\" Analyse nicht möglich"
msgid "Theme saved to: %s"
msgstr "Einstellung \"%s%s%s\":"
#, fuzzy, c-format
#| msgid "%sCannot create file \"%s\""
msgid "%sCannot rename built-in theme \"%s\""
msgstr "%sDie Datei \"%s\" kann nicht erstellt werden"
#, c-format
msgid "%sNew name is the same as old name"
msgstr ""
#, fuzzy, c-format
#| msgid "%sBar \"%s\" already exists"
msgid "%sTheme \"%s\" already exists"
msgstr "%sBar \"%s\" existiert bereits"
#, fuzzy, c-format
#| msgid "%sUnable to rename filter \"%s\" to \"%s\""
msgid "%sFailed to rename theme \"%s\" to \"%s\""
msgstr "%sUmbenennung des Filters von \"%s\" in \"%s\" nicht möglich"
#, fuzzy, c-format
#| msgid "Trigger \"%s\" renamed to \"%s\""
msgid "Theme \"%s\" renamed to \"%s\""
msgstr "Trigger \"%s\" wurde umbenannt. Der neue Name lautet \"%s\""
#, fuzzy, c-format
#| msgid "%sCannot create file \"%s\""
msgid "%sCannot delete built-in theme \"%s\""
+32 -3
View File
@@ -24,7 +24,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2026-07-04 21:01+0200\n"
"POT-Creation-Date: 2026-07-04 21:31+0200\n"
"PO-Revision-Date: 2026-06-28 08:46+0200\n"
"Last-Translator: Santiago Forero <santiago@forero.xyz>\n"
"Language-Team: Spanish <weechat-dev@nongnu.org>\n"
@@ -3806,8 +3806,8 @@ msgstr "lista de elementos de barra"
#. TRANSLATORS: only text between angle brackets (eg: "<name>") may be translated
msgid ""
"[list [-backups]] || apply <name> || reset || save <name> [-full] || del "
"<name> || info <name>"
"[list [-backups]] || apply <name> || reset || save <name> [-full] || rename "
"<old> <new> || del <name> || info <name>"
msgstr ""
#, fuzzy
@@ -3839,6 +3839,11 @@ msgid ""
"match a built-in theme or start with \"backup-\""
msgstr ""
#, fuzzy
#| msgid "names of filters"
msgid "raw[rename]: rename a user theme file"
msgstr "nombre de los filtros"
#, fuzzy
#| msgid "get/set channel topic"
msgid "raw[del]: delete a user theme file"
@@ -4459,6 +4464,9 @@ msgstr ""
msgid "names of user theme files (without built-ins and backups)"
msgstr ""
msgid "names of theme files on disk (user files + backups, no built-ins)"
msgstr ""
msgid "names of secured data (file sec.conf, section data)"
msgstr ""
@@ -6553,6 +6561,27 @@ msgstr "%s%s: no es posible analizar el archivo \"%s\""
msgid "Theme saved to: %s"
msgstr "Opción \"%s%s%s\":"
#, fuzzy, c-format
msgid "%sCannot rename built-in theme \"%s\""
msgstr "%sError: no es posible crear el archivo \"%s\""
#, c-format
msgid "%sNew name is the same as old name"
msgstr ""
#, fuzzy, c-format
msgid "%sTheme \"%s\" already exists"
msgstr "%sError: el filtro \"%s\" ya existe"
#, fuzzy, c-format
#| msgid "%sUnable to rename filter \"%s\" to \"%s\""
msgid "%sFailed to rename theme \"%s\" to \"%s\""
msgstr "%sError: no se pudo renombrar el filtro \"%s\" a \"%s\""
#, fuzzy, c-format
msgid "Theme \"%s\" renamed to \"%s\""
msgstr "Filtro \"%s\" renombrado a \"%s\""
#, fuzzy, c-format
msgid "%sCannot delete built-in theme \"%s\""
msgstr "%sError: no es posible crear el archivo \"%s\""
+34 -6
View File
@@ -23,8 +23,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2026-07-04 21:01+0200\n"
"PO-Revision-Date: 2026-07-04 21:08+0200\n"
"POT-Creation-Date: 2026-07-04 21:31+0200\n"
"PO-Revision-Date: 2026-07-04 21:34+0200\n"
"Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n"
"Language-Team: French <flashcode@flashtux.org>\n"
"Language: fr\n"
@@ -4031,11 +4031,11 @@ msgstr "gestion des thèmes de couleurs"
#. TRANSLATORS: only text between angle brackets (eg: "<name>") may be translated
msgid ""
"[list [-backups]] || apply <name> || reset || save <name> [-full] || del "
"<name> || info <name>"
"[list [-backups]] || apply <name> || reset || save <name> [-full] || rename "
"<old> <new> || del <name> || info <name>"
msgstr ""
"[list [-backups]] || apply <nom> || reset || save <nom> [-full] || del <nom> "
"|| info <nom>"
"[list [-backups]] || apply <nom> || reset || save <nom> [-full] || rename "
"<ancien> <nouveau> || del <nom> || info <nom>"
msgid ""
"raw[list]: list registered themes and any *.theme files in the WeeChat "
@@ -4077,6 +4077,9 @@ msgstr ""
"pour écrire toutes les options; le nom ne doit pas correspondre à un thème "
"intégré ou démarrer par \"backup-\""
msgid "raw[rename]: rename a user theme file"
msgstr "raw[rename] : renommer un fichier de thème utilisateur"
msgid "raw[del]: delete a user theme file"
msgstr "raw[del] : supprimer un fichier de thème utilisateur"
@@ -4761,6 +4764,11 @@ msgstr "noms des thèmes (intégrés + fichiers utilisateur + sauvegardes)"
msgid "names of user theme files (without built-ins and backups)"
msgstr "noms des thèmes utilisateur (sans les intégrés et sauvegardes)"
msgid "names of theme files on disk (user files + backups, no built-ins)"
msgstr ""
"noms des fichiers de thèmes sur le disque (fichiers utilisateur + "
"sauvegardes, pas les intégrés)"
msgid "names of secured data (file sec.conf, section data)"
msgstr "noms de données sécurisées (fichier sec.conf, section data)"
@@ -7119,6 +7127,26 @@ msgstr "%sÉchec de sauvegarde du thème \"%s\""
msgid "Theme saved to: %s"
msgstr "Thème sauvegardé vers: %s"
#, c-format
msgid "%sCannot rename built-in theme \"%s\""
msgstr "%sImpossible de renommer le thème intégré \"%s\""
#, c-format
msgid "%sNew name is the same as old name"
msgstr "%sLe nouveau nom est le même que l'ancien"
#, c-format
msgid "%sTheme \"%s\" already exists"
msgstr "%sLe thème \"%s\" existe déjà"
#, c-format
msgid "%sFailed to rename theme \"%s\" to \"%s\""
msgstr "%sImpossible de renommer le thème \"%s\" en \"%s\""
#, c-format
msgid "Theme \"%s\" renamed to \"%s\""
msgstr "Thème \"%s\" renommé en \"%s\""
#, c-format
msgid "%sCannot delete built-in theme \"%s\""
msgstr "%sImpossible de supprimer le thème intégré \"%s\""
+30 -3
View File
@@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2026-07-04 21:01+0200\n"
"POT-Creation-Date: 2026-07-04 21:31+0200\n"
"PO-Revision-Date: 2026-03-08 08:59+0100\n"
"Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n"
"Language-Team: Hungarian <weechat-dev@nongnu.org>\n"
@@ -3559,8 +3559,8 @@ msgstr "Aliaszok listája:\n"
#. TRANSLATORS: only text between angle brackets (eg: "<name>") may be translated
msgid ""
"[list [-backups]] || apply <name> || reset || save <name> [-full] || del "
"<name> || info <name>"
"[list [-backups]] || apply <name> || reset || save <name> [-full] || rename "
"<old> <new> || del <name> || info <name>"
msgstr ""
#, fuzzy
@@ -3591,6 +3591,10 @@ msgid ""
"match a built-in theme or start with \"backup-\""
msgstr ""
#, fuzzy
msgid "raw[rename]: rename a user theme file"
msgstr "Aliaszok listája:\n"
#, fuzzy
#| msgid "get/set channel topic"
msgid "raw[del]: delete a user theme file"
@@ -4181,6 +4185,9 @@ msgstr ""
msgid "names of user theme files (without built-ins and backups)"
msgstr ""
msgid "names of theme files on disk (user files + backups, no built-ins)"
msgstr ""
msgid "names of secured data (file sec.conf, section data)"
msgstr ""
@@ -6057,6 +6064,26 @@ msgstr "Nem sikerült a(z) \"%s\" naplófájlt írni\n"
msgid "Theme saved to: %s"
msgstr "Felhasználók a %s%s%s szobában: %s["
#, fuzzy, c-format
msgid "%sCannot rename built-in theme \"%s\""
msgstr "%s nem sikerült a \"%s\" fájlt létrehozni\n"
#, c-format
msgid "%sNew name is the same as old name"
msgstr ""
#, fuzzy, c-format
msgid "%sTheme \"%s\" already exists"
msgstr "%s az ignore már létezik\n"
#, fuzzy, c-format
msgid "%sFailed to rename theme \"%s\" to \"%s\""
msgstr "%s ismeretlen opció a \"%s\" parancsnak\n"
#, fuzzy, c-format
msgid "Theme \"%s\" renamed to \"%s\""
msgstr "a felhasználók le lettek tiltva"
#, fuzzy, c-format
msgid "%sCannot delete built-in theme \"%s\""
msgstr "%s nem sikerült a \"%s\" fájlt létrehozni\n"
+31 -3
View File
@@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2026-07-04 21:01+0200\n"
"POT-Creation-Date: 2026-07-04 21:31+0200\n"
"PO-Revision-Date: 2026-05-30 14:02+0200\n"
"Last-Translator: Esteban I. Ruiz Moreno <exio4.com@gmail.com>\n"
"Language-Team: Italian <weechat-dev@nongnu.org>\n"
@@ -3737,8 +3737,8 @@ msgstr "elenco degli elementi barra"
#. TRANSLATORS: only text between angle brackets (eg: "<name>") may be translated
msgid ""
"[list [-backups]] || apply <name> || reset || save <name> [-full] || del "
"<name> || info <name>"
"[list [-backups]] || apply <name> || reset || save <name> [-full] || rename "
"<old> <new> || del <name> || info <name>"
msgstr ""
#, fuzzy
@@ -3770,6 +3770,11 @@ msgid ""
"match a built-in theme or start with \"backup-\""
msgstr ""
#, fuzzy
#| msgid "names of filters"
msgid "raw[rename]: rename a user theme file"
msgstr "nomi dei filtri"
#, fuzzy
#| msgid "get/set channel topic"
msgid "raw[del]: delete a user theme file"
@@ -4394,6 +4399,9 @@ msgstr ""
msgid "names of user theme files (without built-ins and backups)"
msgstr ""
msgid "names of theme files on disk (user files + backups, no built-ins)"
msgstr ""
#, fuzzy
msgid "names of secured data (file sec.conf, section data)"
msgstr "nome dei dati sensibili (file sec.conf, sezione data)"
@@ -6539,6 +6547,26 @@ msgstr "%s%s: impossibile analizzare il file \"%s\""
msgid "Theme saved to: %s"
msgstr "Opzione \"%s%s%s\":"
#, fuzzy, c-format
msgid "%sCannot rename built-in theme \"%s\""
msgstr "%sErrore: impossibile creare il file \"%s\""
#, c-format
msgid "%sNew name is the same as old name"
msgstr ""
#, fuzzy, c-format
msgid "%sTheme \"%s\" already exists"
msgstr "%sErrore: il filtro \"%s\" esiste già"
#, fuzzy, c-format
msgid "%sFailed to rename theme \"%s\" to \"%s\""
msgstr "%sErrore: impossibile rinominare il filtro da \"%s\" a \"%s\""
#, fuzzy, c-format
msgid "Theme \"%s\" renamed to \"%s\""
msgstr "Filtro \"%s\" rinominato in \"%s\""
#, fuzzy, c-format
msgid "%sCannot delete built-in theme \"%s\""
msgstr "%sErrore: impossibile creare il file \"%s\""
+33 -3
View File
@@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2026-07-04 21:01+0200\n"
"POT-Creation-Date: 2026-07-04 21:31+0200\n"
"PO-Revision-Date: 2026-05-30 14:02+0200\n"
"Last-Translator: AYANOKOUZI, Ryuunosuke <i38w7i3@yahoo.co.jp>\n"
"Language-Team: Japanese <weechat-dev@nongnu.org>\n"
@@ -3822,8 +3822,8 @@ msgstr "バー要素のリスト"
#. TRANSLATORS: only text between angle brackets (eg: "<name>") may be translated
msgid ""
"[list [-backups]] || apply <name> || reset || save <name> [-full] || del "
"<name> || info <name>"
"[list [-backups]] || apply <name> || reset || save <name> [-full] || rename "
"<old> <new> || del <name> || info <name>"
msgstr ""
#, fuzzy
@@ -3855,6 +3855,11 @@ msgid ""
"match a built-in theme or start with \"backup-\""
msgstr ""
#, fuzzy
#| msgid "names of filters"
msgid "raw[rename]: rename a user theme file"
msgstr "フィルタ名"
#, fuzzy
#| msgid "get/set channel topic"
msgid "raw[del]: delete a user theme file"
@@ -4496,6 +4501,9 @@ msgstr ""
msgid "names of user theme files (without built-ins and backups)"
msgstr ""
msgid "names of theme files on disk (user files + backups, no built-ins)"
msgstr ""
msgid "names of secured data (file sec.conf, section data)"
msgstr "保護データの名前 (sec.conf ファイル、セクションデータ)"
@@ -6715,6 +6723,28 @@ msgstr "%s%s: ファイル \"%s\" を解析できません"
msgid "Theme saved to: %s"
msgstr "オプション \"%s%s%s\":"
#, fuzzy, c-format
msgid "%sCannot rename built-in theme \"%s\""
msgstr "%sエラー: ファイル \"%s\" の作成に失敗"
#, c-format
msgid "%sNew name is the same as old name"
msgstr ""
#, fuzzy, c-format
#| msgid "%s%s: trigger \"%s\" already exists"
msgid "%sTheme \"%s\" already exists"
msgstr "%s%s: トリガ \"%s\" は既に存在します"
#, fuzzy, c-format
msgid "%sFailed to rename theme \"%s\" to \"%s\""
msgstr "%sエラー: フィルタ \"%s\" の名前を \"%s\" に変更できません"
#, fuzzy, c-format
#| msgid "Trigger \"%s\" renamed to \"%s\""
msgid "Theme \"%s\" renamed to \"%s\""
msgstr "トリガ \"%s\" の名前を \"%s\" に変更しました"
#, fuzzy, c-format
msgid "%sCannot delete built-in theme \"%s\""
msgstr "%sエラー: ファイル \"%s\" の作成に失敗"
+35 -3
View File
@@ -23,7 +23,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2026-07-04 21:01+0200\n"
"POT-Creation-Date: 2026-07-04 21:31+0200\n"
"PO-Revision-Date: 2026-06-28 08:55+0200\n"
"Last-Translator: Krzysztof Korościk <soltys@soltys.info>\n"
"Language-Team: Polish <soltys@soltys.info>\n"
@@ -3932,8 +3932,8 @@ msgstr "zarządza niestandardowymi elementami pasków"
#. TRANSLATORS: only text between angle brackets (eg: "<name>") may be translated
msgid ""
"[list [-backups]] || apply <name> || reset || save <name> [-full] || del "
"<name> || info <name>"
"[list [-backups]] || apply <name> || reset || save <name> [-full] || rename "
"<old> <new> || del <name> || info <name>"
msgstr ""
#, fuzzy
@@ -3971,6 +3971,11 @@ msgid ""
"match a built-in theme or start with \"backup-\""
msgstr ""
#, fuzzy
#| msgid "raw[rename]: rename a filter"
msgid "raw[rename]: rename a user theme file"
msgstr "raw[rename]: zmień nazwę filtra"
#, fuzzy
#| msgid "raw[del]: delete a server"
msgid "raw[del]: delete a user theme file"
@@ -4629,6 +4634,9 @@ msgstr ""
msgid "names of user theme files (without built-ins and backups)"
msgstr ""
msgid "names of theme files on disk (user files + backups, no built-ins)"
msgstr ""
msgid "names of secured data (file sec.conf, section data)"
msgstr "nazwy zabezpieczonych danych (plik sec.conf, sekcja data)"
@@ -6898,6 +6906,30 @@ msgstr "%s%s: nie można przetworzyć pliku \"%s\""
msgid "Theme saved to: %s"
msgstr "Opcja \"%s%s%s\":"
#, fuzzy, c-format
#| msgid "%sCannot create file \"%s\""
msgid "%sCannot rename built-in theme \"%s\""
msgstr "%sNie można utworzyć pliku \"%s\""
#, c-format
msgid "%sNew name is the same as old name"
msgstr ""
#, fuzzy, c-format
#| msgid "%sBar \"%s\" already exists"
msgid "%sTheme \"%s\" already exists"
msgstr "%sPasek \"%s\" już istnieje"
#, fuzzy, c-format
#| msgid "%sUnable to rename filter \"%s\" to \"%s\""
msgid "%sFailed to rename theme \"%s\" to \"%s\""
msgstr "%sNie można zmienić nazwy filtru z \"%s\" na \"%s\""
#, fuzzy, c-format
#| msgid "Trigger \"%s\" renamed to \"%s\""
msgid "Theme \"%s\" renamed to \"%s\""
msgstr "Zmieniono nazwę triggera z \"%s\" na \"%s\""
#, fuzzy, c-format
#| msgid "%sCannot create file \"%s\""
msgid "%sCannot delete built-in theme \"%s\""
+33 -3
View File
@@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2026-07-04 21:01+0200\n"
"POT-Creation-Date: 2026-07-04 21:31+0200\n"
"PO-Revision-Date: 2026-06-28 08:48+0200\n"
"Last-Translator: Vasco Almeida <vascomalmeida@sapo.pt>\n"
"Language-Team: Portuguese <weechat-dev@nongnu.org>\n"
@@ -3831,8 +3831,8 @@ msgstr "lista de itens da barra"
#. TRANSLATORS: only text between angle brackets (eg: "<name>") may be translated
msgid ""
"[list [-backups]] || apply <name> || reset || save <name> [-full] || del "
"<name> || info <name>"
"[list [-backups]] || apply <name> || reset || save <name> [-full] || rename "
"<old> <new> || del <name> || info <name>"
msgstr ""
#, fuzzy
@@ -3864,6 +3864,11 @@ msgid ""
"match a built-in theme or start with \"backup-\""
msgstr ""
#, fuzzy
#| msgid "names of filters"
msgid "raw[rename]: rename a user theme file"
msgstr "nomes dos filtros"
#, fuzzy
#| msgid "get/set channel topic"
msgid "raw[del]: delete a user theme file"
@@ -4515,6 +4520,9 @@ msgstr ""
msgid "names of user theme files (without built-ins and backups)"
msgstr ""
msgid "names of theme files on disk (user files + backups, no built-ins)"
msgstr ""
msgid "names of secured data (file sec.conf, section data)"
msgstr "nomes dos ficheiros protegidos (ficheiro sec.conf, secção de dados)"
@@ -6771,6 +6779,28 @@ msgstr "%s%s: não foi possível analisar o ficheiro \"%s\""
msgid "Theme saved to: %s"
msgstr "Opção \"%s%s%s\":"
#, fuzzy, c-format
msgid "%sCannot rename built-in theme \"%s\""
msgstr "%sErro: não é possível criar o ficheiro \"%s\""
#, c-format
msgid "%sNew name is the same as old name"
msgstr ""
#, fuzzy, c-format
#| msgid "%s%s: trigger \"%s\" already exists"
msgid "%sTheme \"%s\" already exists"
msgstr "%s%s: o acionador \"%s\" já existe"
#, fuzzy, c-format
msgid "%sFailed to rename theme \"%s\" to \"%s\""
msgstr "%sErro: não foi possível mudar o nome do filtro \"%s\" para \"%s\""
#, fuzzy, c-format
#| msgid "Trigger \"%s\" renamed to \"%s\""
msgid "Theme \"%s\" renamed to \"%s\""
msgstr "O nome do acionador \"%s\" mudou para \"%s\""
#, fuzzy, c-format
msgid "%sCannot delete built-in theme \"%s\""
msgstr "%sErro: não é possível criar o ficheiro \"%s\""
+31 -3
View File
@@ -46,7 +46,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2026-07-04 21:01+0200\n"
"POT-Creation-Date: 2026-07-04 21:31+0200\n"
"PO-Revision-Date: 2026-06-28 08:49+0200\n"
"Last-Translator: Érico Nogueira <ericonr@disroot.org>\n"
"Language-Team: Portuguese (Brazil) <weechat-dev@nongnu.org>\n"
@@ -3751,8 +3751,8 @@ msgstr "lista de itens da barra"
#. TRANSLATORS: only text between angle brackets (eg: "<name>") may be translated
msgid ""
"[list [-backups]] || apply <name> || reset || save <name> [-full] || del "
"<name> || info <name>"
"[list [-backups]] || apply <name> || reset || save <name> [-full] || rename "
"<old> <new> || del <name> || info <name>"
msgstr ""
#, fuzzy
@@ -3784,6 +3784,11 @@ msgid ""
"match a built-in theme or start with \"backup-\""
msgstr ""
#, fuzzy
#| msgid "names of filters"
msgid "raw[rename]: rename a user theme file"
msgstr "nomes dos filtros"
#, fuzzy
msgid "raw[del]: delete a user theme file"
msgstr "lista de atalhos"
@@ -4419,6 +4424,9 @@ msgstr ""
msgid "names of user theme files (without built-ins and backups)"
msgstr ""
msgid "names of theme files on disk (user files + backups, no built-ins)"
msgstr ""
msgid "names of secured data (file sec.conf, section data)"
msgstr ""
@@ -6437,6 +6445,26 @@ msgstr "%s%s: não foi possível interpretar arquivo \"%s\""
msgid "Theme saved to: %s"
msgstr "Opção \"%s%s%s\":"
#, fuzzy, c-format
msgid "%sCannot rename built-in theme \"%s\""
msgstr "%sErro: não foi possível criar arquivo \"%s\""
#, c-format
msgid "%sNew name is the same as old name"
msgstr ""
#, fuzzy, c-format
msgid "%sTheme \"%s\" already exists"
msgstr "%sErro: filtro \"%s\" já existe"
#, fuzzy, c-format
msgid "%sFailed to rename theme \"%s\" to \"%s\""
msgstr "%sErro: não foi possível renomear filtro \"%s\" para \"%s\""
#, fuzzy, c-format
msgid "Theme \"%s\" renamed to \"%s\""
msgstr "Filtro \"%s\" renomeado para \"%s\""
#, fuzzy, c-format
msgid "%sCannot delete built-in theme \"%s\""
msgstr "%sErro: não foi possível criar arquivo \"%s\""
+30 -3
View File
@@ -23,7 +23,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2026-07-04 21:01+0200\n"
"POT-Creation-Date: 2026-07-04 21:31+0200\n"
"PO-Revision-Date: 2026-03-08 08:59+0100\n"
"Last-Translator: Aleksey V Zapparov AKA ixti <ixti@member.fsf.org>\n"
"Language-Team: Russian <weechat-dev@nongnu.org>\n"
@@ -3583,8 +3583,8 @@ msgstr "Список сокращений:\n"
#. TRANSLATORS: only text between angle brackets (eg: "<name>") may be translated
msgid ""
"[list [-backups]] || apply <name> || reset || save <name> [-full] || del "
"<name> || info <name>"
"[list [-backups]] || apply <name> || reset || save <name> [-full] || rename "
"<old> <new> || del <name> || info <name>"
msgstr ""
#, fuzzy
@@ -3615,6 +3615,10 @@ msgid ""
"match a built-in theme or start with \"backup-\""
msgstr ""
#, fuzzy
msgid "raw[rename]: rename a user theme file"
msgstr "Список сокращений:\n"
#, fuzzy
#| msgid "get/set channel topic"
msgid "raw[del]: delete a user theme file"
@@ -4205,6 +4209,9 @@ msgstr ""
msgid "names of user theme files (without built-ins and backups)"
msgstr ""
msgid "names of theme files on disk (user files + backups, no built-ins)"
msgstr ""
msgid "names of secured data (file sec.conf, section data)"
msgstr ""
@@ -6094,6 +6101,26 @@ msgstr "Не могу записать лог-файл \"%s\"\n"
msgid "Theme saved to: %s"
msgstr "Ники %s%s%s: %s["
#, fuzzy, c-format
msgid "%sCannot rename built-in theme \"%s\""
msgstr "%s не могу создать файл \"%s\"\n"
#, c-format
msgid "%sNew name is the same as old name"
msgstr ""
#, fuzzy, c-format
msgid "%sTheme \"%s\" already exists"
msgstr "%s игнорирование уже существует\n"
#, fuzzy, c-format
msgid "%sFailed to rename theme \"%s\" to \"%s\""
msgstr "%s неизвестный параметр для команды \"%s\"\n"
#, fuzzy, c-format
msgid "Theme \"%s\" renamed to \"%s\""
msgstr "команда users отключена"
#, fuzzy, c-format
msgid "%sCannot delete built-in theme \"%s\""
msgstr "%s не могу создать файл \"%s\"\n"
+35 -3
View File
@@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2026-07-04 21:01+0200\n"
"POT-Creation-Date: 2026-07-04 21:31+0200\n"
"PO-Revision-Date: 2026-06-28 08:52+0200\n"
"Last-Translator: Ivan Pešić <ivan.pesic@gmail.com>\n"
"Language-Team: Serbian <ivan.pesic@gmail.com>\n"
@@ -3909,8 +3909,8 @@ msgstr "управљање прилагођеним ставкама траке"
#. TRANSLATORS: only text between angle brackets (eg: "<name>") may be translated
msgid ""
"[list [-backups]] || apply <name> || reset || save <name> [-full] || del "
"<name> || info <name>"
"[list [-backups]] || apply <name> || reset || save <name> [-full] || rename "
"<old> <new> || del <name> || info <name>"
msgstr ""
#, fuzzy
@@ -3948,6 +3948,11 @@ msgid ""
"match a built-in theme or start with \"backup-\""
msgstr ""
#, fuzzy
#| msgid "raw[rename]: rename a filter"
msgid "raw[rename]: rename a user theme file"
msgstr "raw[rename]: мења име филтеру"
#, fuzzy
#| msgid "raw[del]: delete a server"
msgid "raw[del]: delete a user theme file"
@@ -4604,6 +4609,9 @@ msgstr ""
msgid "names of user theme files (without built-ins and backups)"
msgstr ""
msgid "names of theme files on disk (user files + backups, no built-ins)"
msgstr ""
msgid "names of secured data (file sec.conf, section data)"
msgstr "имена обезбеђених података (фајл sec.conf, одељак data)"
@@ -6880,6 +6888,30 @@ msgstr "%s%s: није успело парсирање фајла „%s”"
msgid "Theme saved to: %s"
msgstr "Опција „%s%s%s”:"
#, fuzzy, c-format
#| msgid "%sCannot create file \"%s\""
msgid "%sCannot rename built-in theme \"%s\""
msgstr "%sНе може да се креира фајл „%s”"
#, c-format
msgid "%sNew name is the same as old name"
msgstr ""
#, fuzzy, c-format
#| msgid "%sBar \"%s\" already exists"
msgid "%sTheme \"%s\" already exists"
msgstr "%sТрака „%s” већ постоји"
#, fuzzy, c-format
#| msgid "%sUnable to rename filter \"%s\" to \"%s\""
msgid "%sFailed to rename theme \"%s\" to \"%s\""
msgstr "%sНије успела промена име филтера „%s” на „%s”"
#, fuzzy, c-format
#| msgid "Trigger \"%s\" renamed to \"%s\""
msgid "Theme \"%s\" renamed to \"%s\""
msgstr "Окидачу „%s” је промењено име у „%s”"
#, fuzzy, c-format
#| msgid "%sCannot create file \"%s\""
msgid "%sCannot delete built-in theme \"%s\""
+35 -3
View File
@@ -23,7 +23,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2026-07-04 21:01+0200\n"
"POT-Creation-Date: 2026-07-04 21:31+0200\n"
"PO-Revision-Date: 2026-06-28 08:53+0200\n"
"Last-Translator: Emir SARI <emir_sari@icloud.com>\n"
"Language-Team: Turkish <emir_sari@icloud.com>\n"
@@ -3768,8 +3768,8 @@ msgstr "özel çubuk ögelerini yönet"
#. TRANSLATORS: only text between angle brackets (eg: "<name>") may be translated
msgid ""
"[list [-backups]] || apply <name> || reset || save <name> [-full] || del "
"<name> || info <name>"
"[list [-backups]] || apply <name> || reset || save <name> [-full] || rename "
"<old> <new> || del <name> || info <name>"
msgstr ""
#, fuzzy
@@ -3803,6 +3803,11 @@ msgid ""
"match a built-in theme or start with \"backup-\""
msgstr ""
#, fuzzy
#| msgid "raw[rename]: rename a filter"
msgid "raw[rename]: rename a user theme file"
msgstr "raw[rename]: Bir süzgeci yeniden adlandır"
#, fuzzy
#| msgid "get/set channel topic"
msgid "raw[del]: delete a user theme file"
@@ -4430,6 +4435,9 @@ msgstr ""
msgid "names of user theme files (without built-ins and backups)"
msgstr ""
msgid "names of theme files on disk (user files + backups, no built-ins)"
msgstr ""
msgid "names of secured data (file sec.conf, section data)"
msgstr "güvenli veri adları (sec.conf dosyası, bölüm verisi)"
@@ -6677,6 +6685,30 @@ msgstr "%s%s: \"%s\" dosyası ayrıştırılamıyor"
msgid "Theme saved to: %s"
msgstr "\"%s%s%s\" seçeneği:"
#, fuzzy, c-format
#| msgid "%sCannot create file \"%s\""
msgid "%sCannot rename built-in theme \"%s\""
msgstr "%s\"%s\" dosyası oluşturulamıyor"
#, c-format
msgid "%sNew name is the same as old name"
msgstr ""
#, fuzzy, c-format
#| msgid "%sBar \"%s\" already exists"
msgid "%sTheme \"%s\" already exists"
msgstr "%s\"%s\" çubuğu halihazırda var"
#, fuzzy, c-format
#| msgid "%sUnable to rename filter \"%s\" to \"%s\""
msgid "%sFailed to rename theme \"%s\" to \"%s\""
msgstr "%s\"%s\" süzgeci \"%s\" olarak yeniden adlandırılamıyor"
#, fuzzy, c-format
#| msgid "Trigger \"%s\" renamed to \"%s\""
msgid "Theme \"%s\" renamed to \"%s\""
msgstr "\"%s\" tetiği \"%s\" olarak yeniden adlandırıldı"
#, fuzzy, c-format
#| msgid "%sCannot create file \"%s\""
msgid "%sCannot delete built-in theme \"%s\""
+29 -3
View File
@@ -23,7 +23,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2026-07-04 21:01+0200\n"
"POT-Creation-Date: 2026-07-04 21:31+0200\n"
"PO-Revision-Date: 2014-08-16 10:27+0200\n"
"Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -3351,8 +3351,8 @@ msgstr ""
#. TRANSLATORS: only text between angle brackets (eg: "<name>") may be translated
msgid ""
"[list [-backups]] || apply <name> || reset || save <name> [-full] || del "
"<name> || info <name>"
"[list [-backups]] || apply <name> || reset || save <name> [-full] || rename "
"<old> <new> || del <name> || info <name>"
msgstr ""
msgid ""
@@ -3382,6 +3382,9 @@ msgid ""
"match a built-in theme or start with \"backup-\""
msgstr ""
msgid "raw[rename]: rename a user theme file"
msgstr ""
msgid "raw[del]: delete a user theme file"
msgstr ""
@@ -3925,6 +3928,9 @@ msgstr ""
msgid "names of user theme files (without built-ins and backups)"
msgstr ""
msgid "names of theme files on disk (user files + backups, no built-ins)"
msgstr ""
msgid "names of secured data (file sec.conf, section data)"
msgstr ""
@@ -5652,6 +5658,26 @@ msgstr ""
msgid "Theme saved to: %s"
msgstr ""
#, c-format
msgid "%sCannot rename built-in theme \"%s\""
msgstr ""
#, c-format
msgid "%sNew name is the same as old name"
msgstr ""
#, c-format
msgid "%sTheme \"%s\" already exists"
msgstr ""
#, c-format
msgid "%sFailed to rename theme \"%s\" to \"%s\""
msgstr ""
#, c-format
msgid "Theme \"%s\" renamed to \"%s\""
msgstr ""
#, c-format
msgid "%sCannot delete built-in theme \"%s\""
msgstr ""
+10
View File
@@ -7355,6 +7355,13 @@ COMMAND_CALLBACK(theme)
? 1 : 0);
}
/* "/theme rename <old> <new>": rename a user theme file */
if (string_strcmp (argv[1], "rename") == 0)
{
COMMAND_MIN_ARGS(4, "rename");
return theme_rename (argv[2], argv[3]);
}
/* "/theme del <name>": remove a user theme file */
if (string_strcmp (argv[1], "del") == 0)
{
@@ -10087,6 +10094,7 @@ command_init (void)
" || apply <name>"
" || reset"
" || save <name> [-full]"
" || rename <old> <new>"
" || del <name>"
" || info <name>"),
CMD_ARGS_DESC(
@@ -10106,6 +10114,7 @@ command_init (void)
"written, use \"-full\" to write every themable option; "
"the name must not match a built-in theme or start with "
"\"backup-\""),
N_("raw[rename]: rename a user theme file"),
N_("raw[del]: delete a user theme file"),
N_("raw[info]: display details on a theme (name, description, "
"creation date, WeeChat version, number of option overrides)"),
@@ -10125,6 +10134,7 @@ command_init (void)
" || apply %(theme_themes_all)"
" || reset"
" || save %(theme_themes_user) -full"
" || rename %(theme_themes_files)"
" || del %(theme_themes_user)"
" || info %(theme_themes_all)",
&command_theme, NULL, NULL);
+38
View File
@@ -2086,6 +2086,40 @@ completion_list_add_theme_themes_user_cb (const void *pointer, void *data,
return WEECHAT_RC_OK;
}
/*
* Add every on-disk theme file (user files + backups, no built-ins)
* to the completion list; suitable for /theme rename which can take a
* backup as its source.
*/
int
completion_list_add_theme_themes_files_cb (const void *pointer, void *data,
const char *completion_item,
struct t_gui_buffer *buffer,
struct t_gui_completion *completion)
{
struct t_completion_theme_dir ctx;
char *dir;
/* make C compiler happy */
(void) pointer;
(void) data;
(void) completion_item;
(void) buffer;
dir = NULL;
string_asprintf (&dir, "%s/themes", weechat_config_dir);
if (dir)
{
ctx.completion = completion;
ctx.show_backups = 1;
dir_exec_on_files (dir, 0, 0, &completion_theme_add_file_cb, &ctx);
free (dir);
}
return WEECHAT_RC_OK;
}
/*
* Add a secured data to completion list.
*/
@@ -2483,6 +2517,10 @@ completion_init (void)
hook_completion (NULL, "theme_themes_user",
N_("names of user theme files (without built-ins and backups)"),
&completion_list_add_theme_themes_user_cb, NULL, NULL);
hook_completion (NULL, "theme_themes_files",
N_("names of theme files on disk (user files + backups, "
"no built-ins)"),
&completion_list_add_theme_themes_files_cb, NULL, NULL);
hook_completion (NULL, "secured_data",
N_("names of secured data (file sec.conf, section data)"),
&completion_list_add_secured_data_cb, NULL, NULL);
+154
View File
@@ -1173,6 +1173,160 @@ theme_save (const char *name, int full)
return WEECHAT_RC_OK;
}
/*
* Rename a user theme file.
*
* Refuse to rename a built-in (no file) or to a name reserved for
* built-ins or automatic backups. The target name must not already
* exist on disk. The file content is copied with the [info] name
* field rewritten so the parsed theme name stays consistent with the
* new filename. If "weechat.look.theme" was pointing at the old name,
* it is updated to the new name.
*
* Return WEECHAT_RC_OK on success, WEECHAT_RC_ERROR on validation or
* I/O failure (in which case no file is created or removed).
*/
int
theme_rename (const char *old_name, const char *new_name)
{
char *old_path, *new_path, line[2048];
FILE *fin, *fout;
const char *trimmed;
int in_info, name_done;
if (!old_name || !old_name[0] || !new_name || !new_name[0])
return WEECHAT_RC_ERROR;
if (theme_search (old_name))
{
gui_chat_printf (NULL,
_("%sCannot rename built-in theme \"%s\""),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
old_name);
return WEECHAT_RC_ERROR;
}
if (strcmp (old_name, new_name) == 0)
{
gui_chat_printf (NULL,
_("%sNew name is the same as old name"),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR]);
return WEECHAT_RC_ERROR;
}
if (strncmp (new_name, "backup-", 7) == 0)
{
gui_chat_printf (NULL,
_("%sName \"%s\" is reserved for automatic backups"),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
new_name);
return WEECHAT_RC_ERROR;
}
if (theme_search (new_name))
{
gui_chat_printf (NULL,
_("%sName \"%s\" is reserved for a built-in theme"),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
new_name);
return WEECHAT_RC_ERROR;
}
old_path = theme_user_file_path (old_name);
if (!old_path)
return WEECHAT_RC_ERROR;
if (access (old_path, R_OK) != 0)
{
gui_chat_printf (NULL,
_("%sTheme \"%s\" not found"),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
old_name);
free (old_path);
return WEECHAT_RC_ERROR;
}
new_path = theme_user_file_path (new_name);
if (!new_path)
{
free (old_path);
return WEECHAT_RC_ERROR;
}
if (access (new_path, F_OK) == 0)
{
gui_chat_printf (NULL,
_("%sTheme \"%s\" already exists"),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
new_name);
free (old_path);
free (new_path);
return WEECHAT_RC_ERROR;
}
fin = fopen (old_path, "r");
fout = (fin) ? fopen (new_path, "w") : NULL;
if (!fin || !fout)
{
if (fin)
fclose (fin);
gui_chat_printf (NULL,
_("%sFailed to rename theme \"%s\" to \"%s\""),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
old_name, new_name);
free (old_path);
free (new_path);
return WEECHAT_RC_ERROR;
}
in_info = 0;
name_done = 0;
while (fgets (line, sizeof (line), fin))
{
trimmed = line;
while (*trimmed == ' ' || *trimmed == '\t')
trimmed++;
if (*trimmed == '[')
{
in_info = (strncmp (trimmed, "[info]", 6) == 0);
fputs (line, fout);
continue;
}
if (in_info && !name_done
&& trimmed[0] == 'n' && trimmed[1] == 'a'
&& trimmed[2] == 'm' && trimmed[3] == 'e'
&& (trimmed[4] == ' ' || trimmed[4] == '\t' || trimmed[4] == '='))
{
fprintf (fout, "name = \"%s\"\n", new_name);
name_done = 1;
continue;
}
fputs (line, fout);
}
fclose (fin);
if (fclose (fout) != 0 || unlink (old_path) != 0)
{
unlink (new_path);
gui_chat_printf (NULL,
_("%sFailed to rename theme \"%s\" to \"%s\""),
gui_chat_prefix[GUI_CHAT_PREFIX_ERROR],
old_name, new_name);
free (old_path);
free (new_path);
return WEECHAT_RC_ERROR;
}
if (strcmp (CONFIG_STRING(config_look_theme), old_name) == 0)
config_file_option_set (config_look_theme, new_name, 1);
gui_chat_printf (NULL,
_("Theme \"%s\" renamed to \"%s\""),
old_name, new_name);
free (old_path);
free (new_path);
return WEECHAT_RC_OK;
}
/*
* Delete a user theme file.
*
+1
View File
@@ -71,6 +71,7 @@ extern struct t_arraylist *theme_list (void);
extern int theme_apply (const char *name);
extern int theme_reset (void);
extern int theme_save (const char *name, int full);
extern int theme_rename (const char *old_name, const char *new_name);
extern int theme_delete (const char *name);
extern char *theme_make_backup (void);
extern char *theme_user_file_path (const char *name);
+76
View File
@@ -975,6 +975,82 @@ TEST(CoreTheme, Delete)
free (path);
}
/*
* Test functions:
* theme_rename
*/
TEST(CoreTheme, Rename)
{
char *src_path, *dst_path;
struct stat st;
FILE *file;
char buf[2048];
size_t len;
/* NULL / empty arguments => error */
LONGS_EQUAL(WEECHAT_RC_ERROR, theme_rename (NULL, "dst"));
LONGS_EQUAL(WEECHAT_RC_ERROR, theme_rename ("src", NULL));
LONGS_EQUAL(WEECHAT_RC_ERROR, theme_rename ("", "dst"));
LONGS_EQUAL(WEECHAT_RC_ERROR, theme_rename ("src", ""));
/* refuses to rename a built-in (no file to rename) */
theme_register (NULL, NULL, "dark", NULL);
LONGS_EQUAL(WEECHAT_RC_ERROR, theme_rename ("dark", "renamed"));
/* refuses target == reserved "backup-" prefix */
LONGS_EQUAL(WEECHAT_RC_OK, theme_save ("rn_src", 0));
LONGS_EQUAL(WEECHAT_RC_ERROR, theme_rename ("rn_src", "backup-foo"));
/* refuses target == built-in name */
LONGS_EQUAL(WEECHAT_RC_ERROR, theme_rename ("rn_src", "dark"));
/* refuses same name */
LONGS_EQUAL(WEECHAT_RC_ERROR, theme_rename ("rn_src", "rn_src"));
/* source missing => error */
LONGS_EQUAL(WEECHAT_RC_ERROR, theme_rename ("does_not_exist", "rn_dst"));
/* refuses target that already exists */
LONGS_EQUAL(WEECHAT_RC_OK, theme_save ("rn_dst", 0));
LONGS_EQUAL(WEECHAT_RC_ERROR, theme_rename ("rn_src", "rn_dst"));
LONGS_EQUAL(WEECHAT_RC_OK, theme_delete ("rn_dst"));
/* happy path: rename moves the file and rewrites the [info] name */
src_path = theme_user_file_path ("rn_src");
dst_path = theme_user_file_path ("rn_dst");
CHECK(src_path != NULL);
CHECK(dst_path != NULL);
LONGS_EQUAL(WEECHAT_RC_OK, theme_rename ("rn_src", "rn_dst"));
/* old file gone, new file exists */
LONGS_EQUAL(-1, stat (src_path, &st));
LONGS_EQUAL(0, stat (dst_path, &st));
/* [info] name field inside the renamed file is updated */
file = fopen (dst_path, "r");
CHECK(file != NULL);
len = fread (buf, 1, sizeof (buf) - 1, file);
buf[len] = '\0';
fclose (file);
CHECK(strstr (buf, "name = \"rn_dst\"") != NULL);
CHECK(strstr (buf, "name = \"rn_src\"") == NULL);
/* if weechat.look.theme pointed at the old name, the label moves too */
LONGS_EQUAL(WEECHAT_RC_OK, theme_save ("rn_active", 0));
config_file_option_set (config_look_theme, "rn_active", 1);
LONGS_EQUAL(WEECHAT_RC_OK, theme_rename ("rn_active", "rn_moved"));
STRCMP_EQUAL("rn_moved", CONFIG_STRING(config_look_theme));
/* cleanup */
config_file_option_reset (config_look_theme, 1);
theme_delete ("rn_dst");
theme_delete ("rn_moved");
free (src_path);
free (dst_path);
}
/*
* Test functions:
* theme_init