From: Christophe CURIS <christophe.cu...@free.fr>

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.cu...@free.fr>
---
 po/be.po     |  4 ++--
 po/bg.po     |  4 ++--
 po/bs.po     |  4 ++--
 po/ca.po     |  4 ++--
 po/cs.po     |  4 ++--
 po/da.po     |  4 ++--
 po/de.po     |  4 ++--
 po/el.po     |  4 ++--
 po/es.po     |  4 ++--
 po/et.po     |  4 ++--
 po/fi.po     |  4 ++--
 po/fr.po     |  4 ++--
 po/gl.po     |  4 ++--
 po/hr.po     |  4 ++--
 po/hu.po     |  4 ++--
 po/hy.po     |  4 ++--
 po/it.po     |  4 ++--
 po/ja.po     |  4 ++--
 po/ko.po     |  4 ++--
 po/ms.po     |  4 ++--
 po/nl.po     |  4 ++--
 po/pl.po     |  4 ++--
 po/pt.po     |  4 ++--
 po/ru.po     |  4 ++--
 po/sk.po     |  4 ++--
 po/tr.po     |  4 ++--
 po/zh_CN.po  |  4 ++--
 po/zh_TW.po  |  4 ++--
 src/dialog.c | 14 +++++---------
 29 files changed, 61 insertions(+), 65 deletions(-)

diff --git a/po/be.po b/po/be.po
index 846452a..218da1d 100644
--- a/po/be.po
+++ b/po/be.po
@@ -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 "
diff --git a/po/bg.po b/po/bg.po
index 5a8d396..8f1aed0 100644
--- a/po/bg.po
+++ b/po/bg.po
@@ -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
diff --git a/po/bs.po b/po/bs.po
index 76b99a3..c8ed244 100644
--- a/po/bs.po
+++ b/po/bs.po
@@ -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 "
diff --git a/po/ca.po b/po/ca.po
index 96eec2b..cc02076 100644
--- a/po/ca.po
+++ b/po/ca.po
@@ -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 "
diff --git a/po/cs.po b/po/cs.po
index 8a7d0e8..8d651ba 100644
--- a/po/cs.po
+++ b/po/cs.po
@@ -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 "
diff --git a/po/da.po b/po/da.po
index 6d6242e..b88cfad 100644
--- a/po/da.po
+++ b/po/da.po
@@ -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
diff --git a/po/de.po b/po/de.po
index 5273b27..41c7df3 100644
--- a/po/de.po
+++ b/po/de.po
@@ -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 "
diff --git a/po/el.po b/po/el.po
index 5b599a1..b2b5e79 100644
--- a/po/el.po
+++ b/po/el.po
@@ -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 "
diff --git a/po/es.po b/po/es.po
index 066f544..6603e50 100644
--- a/po/es.po
+++ b/po/es.po
@@ -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 "
diff --git a/po/et.po b/po/et.po
index dc7f4ee..868f69c 100644
--- a/po/et.po
+++ b/po/et.po
@@ -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 "
diff --git a/po/fi.po b/po/fi.po
index 8f599ed..f82c92e 100644
--- a/po/fi.po
+++ b/po/fi.po
@@ -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 "
diff --git a/po/fr.po b/po/fr.po
index d163709..21e7d39 100644
--- a/po/fr.po
+++ b/po/fr.po
@@ -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 "
diff --git a/po/gl.po b/po/gl.po
index 79157ed..304f7f4 100644
--- a/po/gl.po
+++ b/po/gl.po
@@ -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 "
diff --git a/po/hr.po b/po/hr.po
index 6c99246..61e77c7 100644
--- a/po/hr.po
+++ b/po/hr.po
@@ -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 "
diff --git a/po/hu.po b/po/hu.po
index 10d1428..19ffdb8 100644
--- a/po/hu.po
+++ b/po/hu.po
@@ -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 "
diff --git a/po/hy.po b/po/hy.po
index e2616f7..7fa200f 100644
--- a/po/hy.po
+++ b/po/hy.po
@@ -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 "
diff --git a/po/it.po b/po/it.po
index 53bbc8a..3176dcb 100644
--- a/po/it.po
+++ b/po/it.po
@@ -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 "
diff --git a/po/ja.po b/po/ja.po
index 93b5189..163ad36 100644
--- a/po/ja.po
+++ b/po/ja.po
@@ -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 "
diff --git a/po/ko.po b/po/ko.po
index 831b018..1963dc7 100644
--- a/po/ko.po
+++ b/po/ko.po
@@ -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 "
diff --git a/po/ms.po b/po/ms.po
index 04ddec6..d419bde 100644
--- a/po/ms.po
+++ b/po/ms.po
@@ -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 "
diff --git a/po/nl.po b/po/nl.po
index 88c7232..66db08f 100644
--- a/po/nl.po
+++ b/po/nl.po
@@ -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 "
diff --git a/po/pl.po b/po/pl.po
index af59432..88a214d 100644
--- a/po/pl.po
+++ b/po/pl.po
@@ -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 "
diff --git a/po/pt.po b/po/pt.po
index 0f1fc39..37e080f 100644
--- a/po/pt.po
+++ b/po/pt.po
@@ -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 "
diff --git a/po/ru.po b/po/ru.po
index cbcc1c9..93fc02d 100644
--- a/po/ru.po
+++ b/po/ru.po
@@ -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 "
diff --git a/po/sk.po b/po/sk.po
index ca9db10..5942594 100644
--- a/po/sk.po
+++ b/po/sk.po
@@ -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 "
diff --git a/po/tr.po b/po/tr.po
index 57bbc61..46f1528 100644
--- a/po/tr.po
+++ b/po/tr.po
@@ -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 "
diff --git a/po/zh_CN.po b/po/zh_CN.po
index 5af76c3..cf529a5 100644
--- a/po/zh_CN.po
+++ b/po/zh_CN.po
@@ -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 "
diff --git a/po/zh_TW.po b/po/zh_TW.po
index 6bac9ac..dcbd230 100644
--- a/po/zh_TW.po
+++ b/po/zh_TW.po
@@ -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 "
diff --git a/src/dialog.c b/src/dialog.c
index d14d336..6bb3424 100644
--- a/src/dialog.c
+++ b/src/dialog.c
@@ -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;
        }
 
-- 
2.1.1


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.

Reply via email to