1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-18 12:00:31 +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:
Christophe CURIS
2014-11-29 16:35:22 +01:00
committed by Carlos R. Mafra
parent 7542451a04
commit 7bf2565316
29 changed files with 61 additions and 65 deletions

View File

@@ -306,8 +306,8 @@ msgid "Cancel"
msgstr "Адмена"
#: ../src/dialog.c:299
msgid "Could not open directory "
msgstr "Немагчыма адкрыць каталаг "
msgid "Could not open directory \"%s\":\n%s"
msgstr "Немагчыма адкрыць каталаг \"%s\":\n%s"
#: ../src/dialog.c:354
msgid "Could not load image file "

View File

@@ -423,8 +423,8 @@ msgstr "Отменям"
#
# ../src/dialog.c:225
#: ../src/dialog.c:299
msgid "Could not open directory "
msgstr "Не може да бъде отворена директорията "
msgid "Could not open directory \"%s\":\n%s"
msgstr "Не може да бъде отворена директорията \"%s\":\n%s"
# ../src/dialog.c:280
#: ../src/dialog.c:354

View File

@@ -212,8 +212,8 @@ msgid "Cancel"
msgstr "Poništi"
#: ../src/dialog.c:210
msgid "Could not open directory "
msgstr "Ne mogu otvoriti direktorij "
msgid "Could not open directory \"%s\":\n%s"
msgstr "Ne mogu otvoriti direktorij \"%s\":\n%s"
#: ../src/dialog.c:266
msgid "Could not load image file "

View File

@@ -321,8 +321,8 @@ msgid "Cancel"
msgstr "Cancel·la"
#: ../src/dialog.c:290
msgid "Could not open directory "
msgstr "No s'ha pogut obrir el directori"
msgid "Could not open directory \"%s\":\n%s"
msgstr "No s'ha pogut obrir el directori \"%s\":\n%s"
#: ../src/dialog.c:345
msgid "Could not load image file "

View File

@@ -312,8 +312,8 @@ msgid "Cancel"
msgstr "Zrušit"
#: ../src/dialog.c:219
msgid "Could not open directory "
msgstr "Nelze otevřít adresář"
msgid "Could not open directory \"%s\":\n%s"
msgstr "Nelze otevřít adresář \"%s\":\n%s"
#: ../src/dialog.c:274
msgid "Could not load image file "

View File

@@ -385,8 +385,8 @@ msgstr "Annullér"
# ../src/dialog.c:218
#: ../src/dialog.c:277
msgid "Could not open directory "
msgstr "Kunne ikke åbne mappe "
msgid "Could not open directory \"%s\":\n%s"
msgstr "Kunne ikke åbne mappe \"%s\":\n%s"
# ../src/dialog.c:271
#: ../src/dialog.c:332

View File

@@ -335,8 +335,8 @@ msgid "Cancel"
msgstr "Abbrechen"
#: ../src/dialog.c:563
msgid "Could not open directory "
msgstr "Verzeichnis konnte nicht geöffnet werden"
msgid "Could not open directory \"%s\":\n%s"
msgstr "Verzeichnis konnte nicht geöffnet werden \"%s\":\n%s"
#: ../src/dialog.c:613
msgid "Could not load image file "

View File

@@ -260,8 +260,8 @@ msgid "Cancel"
msgstr "Άκυρο"
#: ../src/dialog.c:218
msgid "Could not open directory "
msgstr "Αδύνατο να ανοιχθεί ο κατάλογος "
msgid "Could not open directory \"%s\":\n%s"
msgstr "Αδύνατο να ανοιχθεί ο κατάλογος \"%s\":\n%s"
#: ../src/dialog.c:271
msgid "Could not load image file "

View File

@@ -342,8 +342,8 @@ msgid "Cancel"
msgstr "Cancelar"
#: ../src/dialog.c:558
msgid "Could not open directory "
msgstr "No se pudo abrir el directorio "
msgid "Could not open directory \"%s\":\n%s"
msgstr "No se pudo abrir el directorio \"%s\":\n%s"
#: ../src/dialog.c:608
msgid "Could not load image file "

View File

@@ -341,8 +341,8 @@ msgid "Cancel"
msgstr "Loobu"
#: ../src/dialog.c:558
msgid "Could not open directory "
msgstr "Pole võimalik avada kataloogi "
msgid "Could not open directory \"%s\":\n%s"
msgstr "Pole võimalik avada kataloogi \"%s\":\n%s"
#: ../src/dialog.c:608
msgid "Could not load image file "

View File

@@ -304,8 +304,8 @@ msgid "Cancel"
msgstr "Peruuta"
#: ../src/dialog.c:219
msgid "Could not open directory "
msgstr "Ei voi avata hakemistoa "
msgid "Could not open directory \"%s\":\n%s"
msgstr "Ei voi avata hakemistoa \"%s\":\n%s"
#: ../src/dialog.c:274
msgid "Could not load image file "

View File

@@ -311,8 +311,8 @@ msgid "Cancel"
msgstr "Annuler"
#: ../src/dialog.c:290
msgid "Could not open directory "
msgstr "Impossible d'accéder au répertoire "
msgid "Could not open directory \"%s\":\n%s"
msgstr "Impossible d'accéder au répertoire « %s »:\n%s"
#: ../src/dialog.c:345
msgid "Could not load image file "

View File

@@ -304,8 +304,8 @@ msgid "Cancel"
msgstr "Cancelar"
#: ../src/dialog.c:225
msgid "Could not open directory "
msgstr "Non foi posible abri-lo directorio "
msgid "Could not open directory \"%s\":\n%s"
msgstr "Non foi posible abri-lo directorio \"%s\":\n%s"
#: ../src/dialog.c:280
msgid "Could not load image file "

View File

@@ -211,8 +211,8 @@ msgid "Cancel"
msgstr "Otkaži"
#: ../src/dialog.c:210
msgid "Could not open directory "
msgstr "Ne mogu otvoriti direktorij "
msgid "Could not open directory \"%s\":\n%s"
msgstr "Ne mogu otvoriti direktorij \"%s\":\n%s"
#: ../src/dialog.c:266
msgid "Could not load image file "

View File

@@ -332,8 +332,8 @@ msgid "Cancel"
msgstr "Mégsem"
#: ../../wmaker-crm/src/dialog.c:576
msgid "Could not open directory "
msgstr "Nem sikerült megnyitni ezt a könyvtárat: "
msgid "Could not open directory \"%s\":\n%s"
msgstr "Nem sikerült megnyitni ezt a könyvtárat \"%s\":\n%s"
#: ../../wmaker-crm/src/dialog.c:626
msgid "Could not load image file "

View File

@@ -407,8 +407,8 @@ msgid "Cancel"
msgstr "Հրաժարվել"
#: ../src/dialog.c:290
msgid "Could not open directory "
msgstr "Հնարավոր չէ բացել պանակը"
msgid "Could not open directory \"%s\":\n%s"
msgstr "Հնարավոր չէ բացել պանակը \"%s\":\n%s"
#: ../src/dialog.c:345
msgid "Could not load image file "

View File

@@ -345,8 +345,8 @@ msgid "Cancel"
msgstr "Annulla"
#: ../src/dialog.c:290
msgid "Could not open directory "
msgstr "Impossibile aprire la directory "
msgid "Could not open directory \"%s\":\n%s"
msgstr "Impossibile aprire la directory \"%s\":\n%s"
#: ../src/dialog.c:345
msgid "Could not load image file "

View File

@@ -329,8 +329,8 @@ msgid "Cancel"
msgstr "キャンセル"
#: ../src/dialog.c:558
msgid "Could not open directory "
msgstr "ディレクトリを開けません"
msgid "Could not open directory \"%s\":\n%s"
msgstr "ディレクトリを開けません \"%s\":\n%s"
#: ../src/dialog.c:608
msgid "Could not load image file "

View File

@@ -322,8 +322,8 @@ msgid "Cancel"
msgstr "취소"
#: ../src/dialog.c:574
msgid "Could not open directory "
msgstr "디렉터리를 열 수 없음 "
msgid "Could not open directory \"%s\":\n%s"
msgstr "디렉터리를 열 수 없음 \"%s\":\n%s"
#: ../src/dialog.c:624
msgid "Could not load image file "

View File

@@ -304,8 +304,8 @@ msgid "Cancel"
msgstr "Batal"
#: ../src/dialog.c:277
msgid "Could not open directory "
msgstr "Tak dapat membuka direktori"
msgid "Could not open directory \"%s\":\n%s"
msgstr "Tak dapat membuka direktori \"%s\":\n%s"
#: ../src/dialog.c:332
msgid "Could not load image file "

View File

@@ -327,8 +327,8 @@ msgid "Cancel"
msgstr "Annuleren"
#: ../src/dialog.c:577
msgid "Could not open directory "
msgstr "Openen mislukt van map "
msgid "Could not open directory \"%s\":\n%s"
msgstr "Openen mislukt van map \"%s\":\n%s"
#: ../src/dialog.c:628
msgid "Could not load image file "

View File

@@ -227,8 +227,8 @@ msgid "Cancel"
msgstr "Anuluj"
#: ../src/dialog.c:211
msgid "Could not open directory "
msgstr "Nie można otworzyć katalogu "
msgid "Could not open directory \"%s\":\n%s"
msgstr "Nie można otworzyć katalogu \"%s\":\n%s"
#: ../src/dialog.c:267
msgid "Could not load image file "

View File

@@ -295,8 +295,8 @@ msgid "Cancel"
msgstr "Cancelar"
#: ../src/dialog.c:225
msgid "Could not open directory "
msgstr "Não foi possível abrir diretório "
msgid "Could not open directory \"%s\":\n%s"
msgstr "Não foi possível abrir diretório \"%s\":\n%s"
#: ../src/dialog.c:280
msgid "Could not load image file "

View File

@@ -324,8 +324,8 @@ msgstr "Отказ"
#
#: ../src/dialog.c:299
msgid "Could not open directory "
msgstr "Невозможно открыть каталог "
msgid "Could not open directory \"%s\":\n%s"
msgstr "Невозможно открыть каталог \"%s\":\n%s"
#: ../src/dialog.c:354
msgid "Could not load image file "

View File

@@ -326,8 +326,8 @@ msgid "Cancel"
msgstr "Zrušiť"
#: ../src/dialog.c:290
msgid "Could not open directory "
msgstr "Nemožno otvoriť adresár "
msgid "Could not open directory \"%s\":\n%s"
msgstr "Nemožno otvoriť adresár \"%s\":\n%s"
#: ../src/dialog.c:345
msgid "Could not load image file "

View File

@@ -195,8 +195,8 @@ msgid "No"
msgstr "Hayır"
#: ../src/dialog.c:268
msgid "Could not open directory "
msgstr "Dizin açılamadı"
msgid "Could not open directory \"%s\":\n%s"
msgstr "Dizin açılamadı \"%s\":\n%s"
#: ../src/dialog.c:324
msgid "Could not load image file "

View File

@@ -249,8 +249,8 @@ msgid "Cancel"
msgstr "取消"
#: ../src/dialog.c:218
msgid "Could not open directory "
msgstr "不能打开目录 "
msgid "Could not open directory \"%s\":\n%s"
msgstr "不能打开目录 \"%s\":\n%s"
#: ../src/dialog.c:271
msgid "Could not load image file "

View File

@@ -340,8 +340,8 @@ msgid "Cancel"
msgstr "取消"
#: ../src/dialog.c:290
msgid "Could not open directory "
msgstr "無法開啟目錄"
msgid "Could not open directory \"%s\":\n%s"
msgstr "無法開啟目錄 \"%s\":\n%s"
#: ../src/dialog.c:345
msgid "Could not load image file "

View File

@@ -35,6 +35,7 @@
#include <sys/stat.h>
#include <dirent.h>
#include <limits.h>
#include <errno.h>
#ifdef HAVE_MALLOC_H
#include <malloc.h>
@@ -572,16 +573,11 @@ static void listPixmaps(WScreen *scr, WMList *lPtr, const char *path)
dir = opendir(apath);
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);
snprintf(pbuf, sizeof(pbuf),
_("Could not open directory \"%s\":\n%s"),
path, strerror(errno));
wMessageDialog(scr, _("Error"), pbuf, _("OK"), NULL, NULL);
return;
}