mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 12:28:22 +01:00
wmaker: replaced temporary allocation by local storage for error message
In case of problem with a directory when building the list of files for the Icon Chooser dialog, an error message was generated using a temporary allocated buffer. This is not really good for memory fragmentation, so this patch re-uses the local buffer which will be enough for all reasonable cases. Took opportunity to make message less prone to translation difficulties, and include more information about the problem to the user so he may know what went wrong. Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
This commit is contained in:
committed by
Carlos R. Mafra
parent
7542451a04
commit
7bf2565316
4
po/be.po
4
po/be.po
@@ -306,8 +306,8 @@ msgid "Cancel"
|
|||||||
msgstr "Адмена"
|
msgstr "Адмена"
|
||||||
|
|
||||||
#: ../src/dialog.c:299
|
#: ../src/dialog.c:299
|
||||||
msgid "Could not open directory "
|
msgid "Could not open directory \"%s\":\n%s"
|
||||||
msgstr "Немагчыма адкрыць каталаг "
|
msgstr "Немагчыма адкрыць каталаг \"%s\":\n%s"
|
||||||
|
|
||||||
#: ../src/dialog.c:354
|
#: ../src/dialog.c:354
|
||||||
msgid "Could not load image file "
|
msgid "Could not load image file "
|
||||||
|
|||||||
4
po/bg.po
4
po/bg.po
@@ -423,8 +423,8 @@ msgstr "Отменям"
|
|||||||
#
|
#
|
||||||
# ../src/dialog.c:225
|
# ../src/dialog.c:225
|
||||||
#: ../src/dialog.c:299
|
#: ../src/dialog.c:299
|
||||||
msgid "Could not open directory "
|
msgid "Could not open directory \"%s\":\n%s"
|
||||||
msgstr "Не може да бъде отворена директорията "
|
msgstr "Не може да бъде отворена директорията \"%s\":\n%s"
|
||||||
|
|
||||||
# ../src/dialog.c:280
|
# ../src/dialog.c:280
|
||||||
#: ../src/dialog.c:354
|
#: ../src/dialog.c:354
|
||||||
|
|||||||
4
po/bs.po
4
po/bs.po
@@ -212,8 +212,8 @@ msgid "Cancel"
|
|||||||
msgstr "Poništi"
|
msgstr "Poništi"
|
||||||
|
|
||||||
#: ../src/dialog.c:210
|
#: ../src/dialog.c:210
|
||||||
msgid "Could not open directory "
|
msgid "Could not open directory \"%s\":\n%s"
|
||||||
msgstr "Ne mogu otvoriti direktorij "
|
msgstr "Ne mogu otvoriti direktorij \"%s\":\n%s"
|
||||||
|
|
||||||
#: ../src/dialog.c:266
|
#: ../src/dialog.c:266
|
||||||
msgid "Could not load image file "
|
msgid "Could not load image file "
|
||||||
|
|||||||
4
po/ca.po
4
po/ca.po
@@ -321,8 +321,8 @@ msgid "Cancel"
|
|||||||
msgstr "Cancel·la"
|
msgstr "Cancel·la"
|
||||||
|
|
||||||
#: ../src/dialog.c:290
|
#: ../src/dialog.c:290
|
||||||
msgid "Could not open directory "
|
msgid "Could not open directory \"%s\":\n%s"
|
||||||
msgstr "No s'ha pogut obrir el directori"
|
msgstr "No s'ha pogut obrir el directori \"%s\":\n%s"
|
||||||
|
|
||||||
#: ../src/dialog.c:345
|
#: ../src/dialog.c:345
|
||||||
msgid "Could not load image file "
|
msgid "Could not load image file "
|
||||||
|
|||||||
4
po/cs.po
4
po/cs.po
@@ -312,8 +312,8 @@ msgid "Cancel"
|
|||||||
msgstr "Zrušit"
|
msgstr "Zrušit"
|
||||||
|
|
||||||
#: ../src/dialog.c:219
|
#: ../src/dialog.c:219
|
||||||
msgid "Could not open directory "
|
msgid "Could not open directory \"%s\":\n%s"
|
||||||
msgstr "Nelze otevřít adresář"
|
msgstr "Nelze otevřít adresář \"%s\":\n%s"
|
||||||
|
|
||||||
#: ../src/dialog.c:274
|
#: ../src/dialog.c:274
|
||||||
msgid "Could not load image file "
|
msgid "Could not load image file "
|
||||||
|
|||||||
4
po/da.po
4
po/da.po
@@ -385,8 +385,8 @@ msgstr "Annullér"
|
|||||||
|
|
||||||
# ../src/dialog.c:218
|
# ../src/dialog.c:218
|
||||||
#: ../src/dialog.c:277
|
#: ../src/dialog.c:277
|
||||||
msgid "Could not open directory "
|
msgid "Could not open directory \"%s\":\n%s"
|
||||||
msgstr "Kunne ikke åbne mappe "
|
msgstr "Kunne ikke åbne mappe \"%s\":\n%s"
|
||||||
|
|
||||||
# ../src/dialog.c:271
|
# ../src/dialog.c:271
|
||||||
#: ../src/dialog.c:332
|
#: ../src/dialog.c:332
|
||||||
|
|||||||
4
po/de.po
4
po/de.po
@@ -335,8 +335,8 @@ msgid "Cancel"
|
|||||||
msgstr "Abbrechen"
|
msgstr "Abbrechen"
|
||||||
|
|
||||||
#: ../src/dialog.c:563
|
#: ../src/dialog.c:563
|
||||||
msgid "Could not open directory "
|
msgid "Could not open directory \"%s\":\n%s"
|
||||||
msgstr "Verzeichnis konnte nicht geöffnet werden"
|
msgstr "Verzeichnis konnte nicht geöffnet werden \"%s\":\n%s"
|
||||||
|
|
||||||
#: ../src/dialog.c:613
|
#: ../src/dialog.c:613
|
||||||
msgid "Could not load image file "
|
msgid "Could not load image file "
|
||||||
|
|||||||
4
po/el.po
4
po/el.po
@@ -260,8 +260,8 @@ msgid "Cancel"
|
|||||||
msgstr "Άκυρο"
|
msgstr "Άκυρο"
|
||||||
|
|
||||||
#: ../src/dialog.c:218
|
#: ../src/dialog.c:218
|
||||||
msgid "Could not open directory "
|
msgid "Could not open directory \"%s\":\n%s"
|
||||||
msgstr "Αδύνατο να ανοιχθεί ο κατάλογος "
|
msgstr "Αδύνατο να ανοιχθεί ο κατάλογος \"%s\":\n%s"
|
||||||
|
|
||||||
#: ../src/dialog.c:271
|
#: ../src/dialog.c:271
|
||||||
msgid "Could not load image file "
|
msgid "Could not load image file "
|
||||||
|
|||||||
4
po/es.po
4
po/es.po
@@ -342,8 +342,8 @@ msgid "Cancel"
|
|||||||
msgstr "Cancelar"
|
msgstr "Cancelar"
|
||||||
|
|
||||||
#: ../src/dialog.c:558
|
#: ../src/dialog.c:558
|
||||||
msgid "Could not open directory "
|
msgid "Could not open directory \"%s\":\n%s"
|
||||||
msgstr "No se pudo abrir el directorio "
|
msgstr "No se pudo abrir el directorio \"%s\":\n%s"
|
||||||
|
|
||||||
#: ../src/dialog.c:608
|
#: ../src/dialog.c:608
|
||||||
msgid "Could not load image file "
|
msgid "Could not load image file "
|
||||||
|
|||||||
4
po/et.po
4
po/et.po
@@ -341,8 +341,8 @@ msgid "Cancel"
|
|||||||
msgstr "Loobu"
|
msgstr "Loobu"
|
||||||
|
|
||||||
#: ../src/dialog.c:558
|
#: ../src/dialog.c:558
|
||||||
msgid "Could not open directory "
|
msgid "Could not open directory \"%s\":\n%s"
|
||||||
msgstr "Pole võimalik avada kataloogi "
|
msgstr "Pole võimalik avada kataloogi \"%s\":\n%s"
|
||||||
|
|
||||||
#: ../src/dialog.c:608
|
#: ../src/dialog.c:608
|
||||||
msgid "Could not load image file "
|
msgid "Could not load image file "
|
||||||
|
|||||||
4
po/fi.po
4
po/fi.po
@@ -304,8 +304,8 @@ msgid "Cancel"
|
|||||||
msgstr "Peruuta"
|
msgstr "Peruuta"
|
||||||
|
|
||||||
#: ../src/dialog.c:219
|
#: ../src/dialog.c:219
|
||||||
msgid "Could not open directory "
|
msgid "Could not open directory \"%s\":\n%s"
|
||||||
msgstr "Ei voi avata hakemistoa "
|
msgstr "Ei voi avata hakemistoa \"%s\":\n%s"
|
||||||
|
|
||||||
#: ../src/dialog.c:274
|
#: ../src/dialog.c:274
|
||||||
msgid "Could not load image file "
|
msgid "Could not load image file "
|
||||||
|
|||||||
4
po/fr.po
4
po/fr.po
@@ -311,8 +311,8 @@ msgid "Cancel"
|
|||||||
msgstr "Annuler"
|
msgstr "Annuler"
|
||||||
|
|
||||||
#: ../src/dialog.c:290
|
#: ../src/dialog.c:290
|
||||||
msgid "Could not open directory "
|
msgid "Could not open directory \"%s\":\n%s"
|
||||||
msgstr "Impossible d'accéder au répertoire "
|
msgstr "Impossible d'accéder au répertoire « %s »:\n%s"
|
||||||
|
|
||||||
#: ../src/dialog.c:345
|
#: ../src/dialog.c:345
|
||||||
msgid "Could not load image file "
|
msgid "Could not load image file "
|
||||||
|
|||||||
4
po/gl.po
4
po/gl.po
@@ -304,8 +304,8 @@ msgid "Cancel"
|
|||||||
msgstr "Cancelar"
|
msgstr "Cancelar"
|
||||||
|
|
||||||
#: ../src/dialog.c:225
|
#: ../src/dialog.c:225
|
||||||
msgid "Could not open directory "
|
msgid "Could not open directory \"%s\":\n%s"
|
||||||
msgstr "Non foi posible abri-lo directorio "
|
msgstr "Non foi posible abri-lo directorio \"%s\":\n%s"
|
||||||
|
|
||||||
#: ../src/dialog.c:280
|
#: ../src/dialog.c:280
|
||||||
msgid "Could not load image file "
|
msgid "Could not load image file "
|
||||||
|
|||||||
4
po/hr.po
4
po/hr.po
@@ -211,8 +211,8 @@ msgid "Cancel"
|
|||||||
msgstr "Otkaži"
|
msgstr "Otkaži"
|
||||||
|
|
||||||
#: ../src/dialog.c:210
|
#: ../src/dialog.c:210
|
||||||
msgid "Could not open directory "
|
msgid "Could not open directory \"%s\":\n%s"
|
||||||
msgstr "Ne mogu otvoriti direktorij "
|
msgstr "Ne mogu otvoriti direktorij \"%s\":\n%s"
|
||||||
|
|
||||||
#: ../src/dialog.c:266
|
#: ../src/dialog.c:266
|
||||||
msgid "Could not load image file "
|
msgid "Could not load image file "
|
||||||
|
|||||||
4
po/hu.po
4
po/hu.po
@@ -332,8 +332,8 @@ msgid "Cancel"
|
|||||||
msgstr "Mégsem"
|
msgstr "Mégsem"
|
||||||
|
|
||||||
#: ../../wmaker-crm/src/dialog.c:576
|
#: ../../wmaker-crm/src/dialog.c:576
|
||||||
msgid "Could not open directory "
|
msgid "Could not open directory \"%s\":\n%s"
|
||||||
msgstr "Nem sikerült megnyitni ezt a könyvtárat: "
|
msgstr "Nem sikerült megnyitni ezt a könyvtárat \"%s\":\n%s"
|
||||||
|
|
||||||
#: ../../wmaker-crm/src/dialog.c:626
|
#: ../../wmaker-crm/src/dialog.c:626
|
||||||
msgid "Could not load image file "
|
msgid "Could not load image file "
|
||||||
|
|||||||
4
po/hy.po
4
po/hy.po
@@ -407,8 +407,8 @@ msgid "Cancel"
|
|||||||
msgstr "Հրաժարվել"
|
msgstr "Հրաժարվել"
|
||||||
|
|
||||||
#: ../src/dialog.c:290
|
#: ../src/dialog.c:290
|
||||||
msgid "Could not open directory "
|
msgid "Could not open directory \"%s\":\n%s"
|
||||||
msgstr "Հնարավոր չէ բացել պանակը"
|
msgstr "Հնարավոր չէ բացել պանակը \"%s\":\n%s"
|
||||||
|
|
||||||
#: ../src/dialog.c:345
|
#: ../src/dialog.c:345
|
||||||
msgid "Could not load image file "
|
msgid "Could not load image file "
|
||||||
|
|||||||
4
po/it.po
4
po/it.po
@@ -345,8 +345,8 @@ msgid "Cancel"
|
|||||||
msgstr "Annulla"
|
msgstr "Annulla"
|
||||||
|
|
||||||
#: ../src/dialog.c:290
|
#: ../src/dialog.c:290
|
||||||
msgid "Could not open directory "
|
msgid "Could not open directory \"%s\":\n%s"
|
||||||
msgstr "Impossibile aprire la directory "
|
msgstr "Impossibile aprire la directory \"%s\":\n%s"
|
||||||
|
|
||||||
#: ../src/dialog.c:345
|
#: ../src/dialog.c:345
|
||||||
msgid "Could not load image file "
|
msgid "Could not load image file "
|
||||||
|
|||||||
4
po/ja.po
4
po/ja.po
@@ -329,8 +329,8 @@ msgid "Cancel"
|
|||||||
msgstr "キャンセル"
|
msgstr "キャンセル"
|
||||||
|
|
||||||
#: ../src/dialog.c:558
|
#: ../src/dialog.c:558
|
||||||
msgid "Could not open directory "
|
msgid "Could not open directory \"%s\":\n%s"
|
||||||
msgstr "ディレクトリを開けません"
|
msgstr "ディレクトリを開けません \"%s\":\n%s"
|
||||||
|
|
||||||
#: ../src/dialog.c:608
|
#: ../src/dialog.c:608
|
||||||
msgid "Could not load image file "
|
msgid "Could not load image file "
|
||||||
|
|||||||
4
po/ko.po
4
po/ko.po
@@ -322,8 +322,8 @@ msgid "Cancel"
|
|||||||
msgstr "취소"
|
msgstr "취소"
|
||||||
|
|
||||||
#: ../src/dialog.c:574
|
#: ../src/dialog.c:574
|
||||||
msgid "Could not open directory "
|
msgid "Could not open directory \"%s\":\n%s"
|
||||||
msgstr "디렉터리를 열 수 없음 "
|
msgstr "디렉터리를 열 수 없음 \"%s\":\n%s"
|
||||||
|
|
||||||
#: ../src/dialog.c:624
|
#: ../src/dialog.c:624
|
||||||
msgid "Could not load image file "
|
msgid "Could not load image file "
|
||||||
|
|||||||
4
po/ms.po
4
po/ms.po
@@ -304,8 +304,8 @@ msgid "Cancel"
|
|||||||
msgstr "Batal"
|
msgstr "Batal"
|
||||||
|
|
||||||
#: ../src/dialog.c:277
|
#: ../src/dialog.c:277
|
||||||
msgid "Could not open directory "
|
msgid "Could not open directory \"%s\":\n%s"
|
||||||
msgstr "Tak dapat membuka direktori"
|
msgstr "Tak dapat membuka direktori \"%s\":\n%s"
|
||||||
|
|
||||||
#: ../src/dialog.c:332
|
#: ../src/dialog.c:332
|
||||||
msgid "Could not load image file "
|
msgid "Could not load image file "
|
||||||
|
|||||||
4
po/nl.po
4
po/nl.po
@@ -327,8 +327,8 @@ msgid "Cancel"
|
|||||||
msgstr "Annuleren"
|
msgstr "Annuleren"
|
||||||
|
|
||||||
#: ../src/dialog.c:577
|
#: ../src/dialog.c:577
|
||||||
msgid "Could not open directory "
|
msgid "Could not open directory \"%s\":\n%s"
|
||||||
msgstr "Openen mislukt van map "
|
msgstr "Openen mislukt van map \"%s\":\n%s"
|
||||||
|
|
||||||
#: ../src/dialog.c:628
|
#: ../src/dialog.c:628
|
||||||
msgid "Could not load image file "
|
msgid "Could not load image file "
|
||||||
|
|||||||
4
po/pl.po
4
po/pl.po
@@ -227,8 +227,8 @@ msgid "Cancel"
|
|||||||
msgstr "Anuluj"
|
msgstr "Anuluj"
|
||||||
|
|
||||||
#: ../src/dialog.c:211
|
#: ../src/dialog.c:211
|
||||||
msgid "Could not open directory "
|
msgid "Could not open directory \"%s\":\n%s"
|
||||||
msgstr "Nie można otworzyć katalogu "
|
msgstr "Nie można otworzyć katalogu \"%s\":\n%s"
|
||||||
|
|
||||||
#: ../src/dialog.c:267
|
#: ../src/dialog.c:267
|
||||||
msgid "Could not load image file "
|
msgid "Could not load image file "
|
||||||
|
|||||||
4
po/pt.po
4
po/pt.po
@@ -295,8 +295,8 @@ msgid "Cancel"
|
|||||||
msgstr "Cancelar"
|
msgstr "Cancelar"
|
||||||
|
|
||||||
#: ../src/dialog.c:225
|
#: ../src/dialog.c:225
|
||||||
msgid "Could not open directory "
|
msgid "Could not open directory \"%s\":\n%s"
|
||||||
msgstr "Não foi possível abrir diretório "
|
msgstr "Não foi possível abrir diretório \"%s\":\n%s"
|
||||||
|
|
||||||
#: ../src/dialog.c:280
|
#: ../src/dialog.c:280
|
||||||
msgid "Could not load image file "
|
msgid "Could not load image file "
|
||||||
|
|||||||
4
po/ru.po
4
po/ru.po
@@ -324,8 +324,8 @@ msgstr "Отказ"
|
|||||||
|
|
||||||
#
|
#
|
||||||
#: ../src/dialog.c:299
|
#: ../src/dialog.c:299
|
||||||
msgid "Could not open directory "
|
msgid "Could not open directory \"%s\":\n%s"
|
||||||
msgstr "Невозможно открыть каталог "
|
msgstr "Невозможно открыть каталог \"%s\":\n%s"
|
||||||
|
|
||||||
#: ../src/dialog.c:354
|
#: ../src/dialog.c:354
|
||||||
msgid "Could not load image file "
|
msgid "Could not load image file "
|
||||||
|
|||||||
4
po/sk.po
4
po/sk.po
@@ -326,8 +326,8 @@ msgid "Cancel"
|
|||||||
msgstr "Zrušiť"
|
msgstr "Zrušiť"
|
||||||
|
|
||||||
#: ../src/dialog.c:290
|
#: ../src/dialog.c:290
|
||||||
msgid "Could not open directory "
|
msgid "Could not open directory \"%s\":\n%s"
|
||||||
msgstr "Nemožno otvoriť adresár "
|
msgstr "Nemožno otvoriť adresár \"%s\":\n%s"
|
||||||
|
|
||||||
#: ../src/dialog.c:345
|
#: ../src/dialog.c:345
|
||||||
msgid "Could not load image file "
|
msgid "Could not load image file "
|
||||||
|
|||||||
4
po/tr.po
4
po/tr.po
@@ -195,8 +195,8 @@ msgid "No"
|
|||||||
msgstr "Hayır"
|
msgstr "Hayır"
|
||||||
|
|
||||||
#: ../src/dialog.c:268
|
#: ../src/dialog.c:268
|
||||||
msgid "Could not open directory "
|
msgid "Could not open directory \"%s\":\n%s"
|
||||||
msgstr "Dizin açılamadı"
|
msgstr "Dizin açılamadı \"%s\":\n%s"
|
||||||
|
|
||||||
#: ../src/dialog.c:324
|
#: ../src/dialog.c:324
|
||||||
msgid "Could not load image file "
|
msgid "Could not load image file "
|
||||||
|
|||||||
@@ -249,8 +249,8 @@ msgid "Cancel"
|
|||||||
msgstr "取消"
|
msgstr "取消"
|
||||||
|
|
||||||
#: ../src/dialog.c:218
|
#: ../src/dialog.c:218
|
||||||
msgid "Could not open directory "
|
msgid "Could not open directory \"%s\":\n%s"
|
||||||
msgstr "不能打开目录 "
|
msgstr "不能打开目录 \"%s\":\n%s"
|
||||||
|
|
||||||
#: ../src/dialog.c:271
|
#: ../src/dialog.c:271
|
||||||
msgid "Could not load image file "
|
msgid "Could not load image file "
|
||||||
|
|||||||
@@ -340,8 +340,8 @@ msgid "Cancel"
|
|||||||
msgstr "取消"
|
msgstr "取消"
|
||||||
|
|
||||||
#: ../src/dialog.c:290
|
#: ../src/dialog.c:290
|
||||||
msgid "Could not open directory "
|
msgid "Could not open directory \"%s\":\n%s"
|
||||||
msgstr "無法開啟目錄"
|
msgstr "無法開啟目錄 \"%s\":\n%s"
|
||||||
|
|
||||||
#: ../src/dialog.c:345
|
#: ../src/dialog.c:345
|
||||||
msgid "Could not load image file "
|
msgid "Could not load image file "
|
||||||
|
|||||||
14
src/dialog.c
14
src/dialog.c
@@ -35,6 +35,7 @@
|
|||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
#ifdef HAVE_MALLOC_H
|
#ifdef HAVE_MALLOC_H
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
@@ -572,16 +573,11 @@ static void listPixmaps(WScreen *scr, WMList *lPtr, const char *path)
|
|||||||
dir = opendir(apath);
|
dir = opendir(apath);
|
||||||
|
|
||||||
if (!dir) {
|
if (!dir) {
|
||||||
char *msg;
|
|
||||||
char *tmp;
|
|
||||||
tmp = _("Could not open directory ");
|
|
||||||
msg = wmalloc(strlen(tmp) + strlen(path) + 6);
|
|
||||||
strcpy(msg, tmp);
|
|
||||||
strcat(msg, path);
|
|
||||||
|
|
||||||
wMessageDialog(scr, _("Error"), msg, _("OK"), NULL, NULL);
|
|
||||||
wfree(msg);
|
|
||||||
wfree(apath);
|
wfree(apath);
|
||||||
|
snprintf(pbuf, sizeof(pbuf),
|
||||||
|
_("Could not open directory \"%s\":\n%s"),
|
||||||
|
path, strerror(errno));
|
||||||
|
wMessageDialog(scr, _("Error"), pbuf, _("OK"), NULL, NULL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user