Skip to content

Commit

Permalink
Add the ability to hide folder icons
Browse files Browse the repository at this point in the history
The minimum width of the add-on window has also been increased slightly.
  • Loading branch information
itagagaki committed Jan 22, 2023
1 parent 382cf55 commit b1d3a8c
Show file tree
Hide file tree
Showing 25 changed files with 78 additions and 6 deletions.
19 changes: 16 additions & 3 deletions content/scripts/messenger.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ const g_ThunderbirdMajorVersion = Services.appinfo.version.split(".")[0];
Services.scriptloader.loadSubScript("chrome://tbsortfolders/content/folderPane.js", window, "UTF-8");

function onLoad(activatedWhileWindowOpen) {
const tbsf_prefs = Services.prefs.getBranch("[email protected].");
let xulname = 'tbsortfolders';
if (g_ThunderbirdMajorVersion >= 91) {
xulname += '_91';
}
WL.injectElements(`
let additionalElements = `
<menupopup id="taskPopup">
<menuitem insertafter="activityManager" id="tbsf_menu_item"
oncommand="window.openDialog('chrome://tbsortfolders/content/${xulname}.xhtml', 'ManuallySortFolders',
Expand All @@ -23,8 +24,20 @@ function onLoad(activatedWhileWindowOpen) {
oncommand="window.openDialog('chrome://tbsortfolders/content/${xulname}.xhtml', 'ManuallySortFolders',
'chrome,titlebar,toolbar,centerscreen,resizable');"
label="&tbsf.menuentry.label;" />
</panelview>`,
["chrome://tbsortfolders/locale/main.dtd"]);
</panelview>`;
if (tbsf_prefs.getStringPref("hide_folder_icons")) {
additionalElements += `
<vbox id="folderPaneBox">
<html:style insertafter="folderPaneHeader">
#folderTree > treechildren::-moz-tree-image {
list-style-image: none;
width: 0;
height: 0;
}
</html:style>
</vbox>`;
}
WL.injectElements(additionalElements, ["chrome://tbsortfolders/locale/main.dtd"]);
}

function onUnload(deactivatedWhileWindowOpen) {
Expand Down
7 changes: 7 additions & 0 deletions content/tbsortfolders.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,13 @@
</hbox>
<description id="startup_folder_notice">&extra.startupfolder.notice;</description>
</groupbox>
<groupbox>
<caption>&extra.misc;</caption>
<vbox>
<checkbox id="hideFolderIcons" label="&extra.hide_folder_icons;"
oncommand="on_hide_folder_icons_changed();" />
</vbox>
</groupbox>
<spacer flex="1" />
<hbox>
<spacer flex="1" />
Expand Down
7 changes: 7 additions & 0 deletions content/tbsortfolders_91.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,13 @@
</hbox>
<description id="startup_folder_notice">&extra.startupfolder.notice;</description>
</groupbox>
<groupbox>
<caption>&extra.misc;</caption>
<vbox>
<checkbox id="hideFolderIcons" label="&extra.hide_folder_icons;"
oncommand="on_hide_folder_icons_changed();" />
</vbox>
</groupbox>
<spacer flex="1" />
<hbox>
<spacer flex="1" />
Expand Down
10 changes: 8 additions & 2 deletions content/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,8 @@ function on_load() {

let width = tbsf_prefs.getStringPref("width");
let height = tbsf_prefs.getStringPref("height");
if (width < 500) {
width = 500;
if (width < 600) {
width = 600;
}
if (height < 400) {
height = 400;
Expand Down Expand Up @@ -801,6 +801,8 @@ function extra_on_load() {
picker.style.display = "none";
}
on_startup_folder_method_changed();

document.getElementById("hideFolderIcons").checked = Boolean(tbsf_prefs.getStringPref("hide_folder_icons"));
}

function on_startup_folder_method_changed() {
Expand All @@ -821,3 +823,7 @@ function on_startup_folder_method_changed() {
document.getElementById("startup_folder_notice").style.display = notice ? "" : "none";

}

function on_hide_folder_icons_changed() {
tbsf_prefs.setStringPref("hide_folder_icons", document.getElementById("hideFolderIcons").checked ? "True" : "");
}
1 change: 1 addition & 0 deletions defaults/preferences/prefs.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ pref("[email protected]_folder", "");
pref("[email protected]", "");
pref("[email protected]", "0");
pref("[email protected]", "0");
pref("[email protected]_folder_icons", "");
2 changes: 2 additions & 0 deletions locale/da/ui.dtd
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,5 @@
<!ENTITY extra.usecustom "Anvend brugervalgt mappe">
<!ENTITY extra.usethisfolder "Anvend denne mappe">
<!ENTITY extra.startupfolder.notice "* Denne funktion fungerer muligvis ikke pålideligt i Thunderbird 97 og tidligere versioner.">
<!ENTITY extra.misc "Div.">
<!ENTITY extra.hide_folder_icons "Skjul mappeikoner (Skal genstarte denne tilføjelse)">
2 changes: 2 additions & 0 deletions locale/de/ui.dtd
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,5 @@
<!ENTITY extra.usecustom "Benutzerdefinierten Ordner verwenden">
<!ENTITY extra.usethisfolder "Diesen Ordner verwenden">
<!ENTITY extra.startupfolder.notice "* Diese Funktion funktioniert möglicherweise nicht zuverlässig in Thunderbird 97 und früheren Versionen.">
<!ENTITY extra.misc "Sonstiges">
<!ENTITY extra.hide_folder_icons "Ordnersymbole ausblenden (Dieses Add-on muss neu gestartet werden)">
2 changes: 2 additions & 0 deletions locale/en-US/ui.dtd
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,5 @@
<!ENTITY extra.usecustom "Use a custom folder">
<!ENTITY extra.usethisfolder "Use this folder">
<!ENTITY extra.startupfolder.notice "* This feature may not work reliably on Thunderbird 97 and earlier versions.">
<!ENTITY extra.misc "Misc.">
<!ENTITY extra.hide_folder_icons "Hide folder icons (Need to restart this add-on)">
2 changes: 2 additions & 0 deletions locale/es-ES/ui.dtd
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,5 @@
<!ENTITY extra.usecustom "Usar una carpeta personalizada">
<!ENTITY extra.usethisfolder "Usar esta carpeta">
<!ENTITY extra.startupfolder.notice "* Es posible que esta función no funcione de forma fiable en Thunderbird 97 y versiones anteriores.">
<!ENTITY extra.misc "Varios">
<!ENTITY extra.hide_folder_icons "Ocultar iconos de carpetas (Es necesario reiniciar este complemento)">
2 changes: 2 additions & 0 deletions locale/fr/ui.dtd
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,5 @@
<!ENTITY extra.usecustom "Choisir un dossier particulier">
<!ENTITY extra.usethisfolder "Utiliser ce dossier">
<!ENTITY extra.startupfolder.notice "* Cette fonction peut ne pas fonctionner de manière fiable dans Thunderbird 97 et les versions antérieures.">
<!ENTITY extra.misc "Divers.">
<!ENTITY extra.hide_folder_icons "Masquer les icônes des dossiers (Il faut redémarrer cet add-on)">
2 changes: 2 additions & 0 deletions locale/hu/ui.dtd
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,5 @@
<!ENTITY extra.usecustom "Egyéni mappa használata">
<!ENTITY extra.usethisfolder "Ezen mappa használata">
<!ENTITY extra.startupfolder.notice "* Ez a funkció a Thunderbird 97 és korábbi verziókban nem feltétlenül működik megbízhatóan.">
<!ENTITY extra.misc "Egyéb">
<!ENTITY extra.hide_folder_icons "Mappaikonok elrejtése (újra kell indítani ezt a bővítményt)">
2 changes: 2 additions & 0 deletions locale/it/ui.dtd
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,5 @@
<!ENTITY extra.usecustom "Utilizza una cartella da selezionare">
<!ENTITY extra.usethisfolder "Utilizza questa cartella">
<!ENTITY extra.startupfolder.notice "* Questa funzione potrebbe non funzionare in modo affidabile in Thunderbird 97 e versioni precedenti.">
<!ENTITY extra.misc "Varie">
<!ENTITY extra.hide_folder_icons "Nascondi le icone delle cartelle (è necessario riavviare questo componente aggiuntivo)">
2 changes: 2 additions & 0 deletions locale/ja/ui.dtd
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,5 @@
<!ENTITY extra.usecustom "カスタムフォルダ">
<!ENTITY extra.usethisfolder "現在のフォルダ">
<!ENTITY extra.startupfolder.notice "* Thunderbird 97以前では、この機能が確実に働かない場合があります。">
<!ENTITY extra.misc "その他">
<!ENTITY extra.hide_folder_icons "フォルダーアイコンを非表示にする (このアドオンの再始動が必要)">
2 changes: 2 additions & 0 deletions locale/nb-NO/ui.dtd
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,5 @@
<!ENTITY extra.usecustom "Bruk en forhåndsvalgt mappe">
<!ENTITY extra.usethisfolder "Bruk denne mappen">
<!ENTITY extra.startupfolder.notice "* Denne funksjonen fungerer kanskje ikke pålitelig i Thunderbird 97 og tidligere versjoner.">
<!ENTITY extra.misc "Diverse">
<!ENTITY extra.hide_folder_icons "Skjul mappeikoner (Må starte dette tillegget på nytt)">
2 changes: 2 additions & 0 deletions locale/nl/ui.dtd
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,5 @@
<!ENTITY extra.usecustom "Aangepaste map gebruiken">
<!ENTITY extra.usethisfolder "Deze map gebruiken">
<!ENTITY extra.startupfolder.notice "* Deze functie werkt mogelijk niet betrouwbaar in Thunderbird 97 en eerdere versies.">
<!ENTITY extra.misc "Diversen">
<!ENTITY extra.hide_folder_icons "Mappictogrammen verbergen (U moet deze add-on opnieuw opstarten)">
2 changes: 2 additions & 0 deletions locale/pl/ui.dtd
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,5 @@
<!ENTITY extra.usecustom "użyj własny folder">
<!ENTITY extra.usethisfolder "Użyj ten folder">
<!ENTITY extra.startupfolder.notice "* Ta funkcja może nie działać niezawodnie w programie Thunderbird 97 i wcześniejszych wersjach.">
<!ENTITY extra.misc "Misc.">
<!ENTITY extra.hide_folder_icons "Ukryj ikony folderów (Wymaga ponownego uruchomienia tego dodatku)">
2 changes: 2 additions & 0 deletions locale/pt-BR/ui.dtd
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,5 @@
<!ENTITY extra.usecustom "Use uma pasta personalizada">
<!ENTITY extra.usethisfolder "Use a presente pasta">
<!ENTITY extra.startupfolder.notice "* Este recurso pode não funcionar de forma confiável nas versões 97 e anteriores do Thunderbird.">
<!ENTITY extra.misc "Diversos">
<!ENTITY extra.hide_folder_icons "Ocultar ícones de pastas (Necessidade de reiniciar este suplemento)">
2 changes: 2 additions & 0 deletions locale/pt/ui.dtd
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,5 @@
<!ENTITY extra.usecustom "Usar uma pasta personalizada">
<!ENTITY extra.usethisfolder "Usar esta pasta">
<!ENTITY extra.startupfolder.notice "* Esta característica pode não funcionar de forma fiável nas versões Thunderbird 97 e anteriores.">
<!ENTITY extra.misc "Diversos">
<!ENTITY extra.hide_folder_icons "Ocultar ícones de pastas (Necessidade de reiniciar este suplemento)">
2 changes: 2 additions & 0 deletions locale/ru-RU/ui.dtd
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,5 @@
<!ENTITY extra.usecustom "папку по вашему выбору">
<!ENTITY extra.usethisfolder "выбрать эту папку">
<!ENTITY extra.startupfolder.notice "* Эта функция может работать ненадежно в Thunderbird 97 и более ранних версиях.">
<!ENTITY extra.misc "Разное">
<!ENTITY extra.hide_folder_icons "Скрыть значки папок (необходимо перезапустить это дополнение)">
2 changes: 2 additions & 0 deletions locale/sk/ui.dtd
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,5 @@
<!ENTITY extra.usecustom "Použiť vlastný priečinok">
<!ENTITY extra.usethisfolder "Použiť tento priečinok">
<!ENTITY extra.startupfolder.notice "* Táto funkcia nemusí spoľahlivo fungovať v programe Thunderbird 97 a starších verziách.">
<!ENTITY extra.misc "Rôzne">
<!ENTITY extra.hide_folder_icons "Skryť ikony priečinkov (Je potrebné reštartovať tento doplnok)">
2 changes: 2 additions & 0 deletions locale/sr/ui.dtd
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,5 @@
<!ENTITY extra.usecustom "Користи прилагођену фасциклу">
<!ENTITY extra.usethisfolder "Користи ову фасциклу">
<!ENTITY extra.startupfolder.notice "* Ова функција можда неће радити поуздано на Тхундербирд-у 97 и старијим верзијама.">
<!ENTITY extra.misc "Мисц.">
<!ENTITY extra.hide_folder_icons "Сакриј иконе директоријума (треба поново покренути овај додатак)">
2 changes: 2 additions & 0 deletions locale/sv-SE/ui.dtd
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,5 @@
<!ENTITY extra.usecustom "Använd en egenvald mapp">
<!ENTITY extra.usethisfolder "Använd denna mapp">
<!ENTITY extra.startupfolder.notice "* Den här funktionen kanske inte fungerar tillförlitligt i Thunderbird 97 och tidigare versioner.">
<!ENTITY extra.misc "Övrigt">
<!ENTITY extra.hide_folder_icons "Dölj mappikoner (Du måste starta om det här tillägget)">
2 changes: 2 additions & 0 deletions locale/zh-CN/ui.dtd
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,5 @@
<!ENTITY extra.usecustom "使用自定义文件夹">
<!ENTITY extra.usethisfolder "使用这个文件夹">
<!ENTITY extra.startupfolder.notice "* 此功能可能无法在 Thunderbird 97 及更早版本上可靠运行。">
<!ENTITY extra.misc "杂项">
<!ENTITY extra.hide_folder_icons "隐藏文件夹图标(需要重启此插件)">
2 changes: 2 additions & 0 deletions locale/zh-TW/ui.dtd
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,5 @@
<!ENTITY extra.usecustom "使用自訂的資料夾">
<!ENTITY extra.usethisfolder "使用這個資料夾">
<!ENTITY extra.startupfolder.notice "* 此功能可能無法在 Thunderbird 97 及更早版本上可靠運行。">
<!ENTITY extra.misc "雜項">
<!ENTITY extra.hide_folder_icons "隱藏文件夾圖標(需要重啟這個插件)">
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manifest_version": 2,
"name": "Manually sort folders",
"description": "__MSG_extensionDescription__",
"version": "2.2.6",
"version": "2.3.0",
"author": "Jonathan Protzenko and Itagaki Fumihiko",
"homepage_url": "https://github.com/protz/Manually-Sort-Folders/wiki",
"applications": {
Expand Down

0 comments on commit b1d3a8c

Please sign in to comment.