This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch master
in repository e16.
View the commit online.
commit c35690b4a4c0260adb9233443a4bae05a57411db
Author: Kim Woelders <[email protected]>
AuthorDate: Tue May 24 07:19:52 2022 +0200
containers: Fix creating new iconboxes
When creating a new iconbox without giving a name (eesh ibox new) as
done by the desktop menu this would not work if an iconbox named _IB_<N>
(<N> being the number of containers) already existed.
---
src/container.c | 20 +++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
diff --git a/src/container.c b/src/container.c
index 1339e51b..5e6330e6 100644
--- a/src/container.c
+++ b/src/container.c
@@ -1920,6 +1920,19 @@ ContainersGetList(int *pnum)
return LIST_GET_ITEMS(Container, &container_list, pnum);
}
+static void
+_ContainersNewName(char *nbuf, unsigned int nlen, const char *pfx)
+{
+ int i;
+
+ for (i = 1;; i++)
+ {
+ Esnprintf(nbuf, nlen, "%s%i", pfx, i);
+ if (!_ContainerFind(nbuf))
+ break;
+ }
+}
+
/*
* IPC functions
*/
@@ -1928,7 +1941,7 @@ _ContainerIpc(const char *params)
{
const char *p;
char cmd[128], prm[128];
- int len, num;
+ int len;
cmd[0] = prm[0] = '\0';
p = params;
@@ -1954,10 +1967,7 @@ _ContainerIpc(const char *params)
Container *ct;
if (!prm[0])
- {
- num = LIST_GET_COUNT(&container_list);
- Esnprintf(prm, sizeof(prm), "_IB_%i", num);
- }
+ _ContainersNewName(prm, sizeof(prm), "_IB_");
ct = _ContainerCreate(prm);
_ContainerShow(ct);
_ContainersConfigSave();
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.