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.
This commit is contained in:
parent
556fadb3c1
commit
c35690b4a4
|
@ -1920,6 +1920,19 @@ ContainersGetList(int *pnum)
|
||||||
return LIST_GET_ITEMS(Container, &container_list, 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
|
* IPC functions
|
||||||
*/
|
*/
|
||||||
|
@ -1928,7 +1941,7 @@ _ContainerIpc(const char *params)
|
||||||
{
|
{
|
||||||
const char *p;
|
const char *p;
|
||||||
char cmd[128], prm[128];
|
char cmd[128], prm[128];
|
||||||
int len, num;
|
int len;
|
||||||
|
|
||||||
cmd[0] = prm[0] = '\0';
|
cmd[0] = prm[0] = '\0';
|
||||||
p = params;
|
p = params;
|
||||||
|
@ -1954,10 +1967,7 @@ _ContainerIpc(const char *params)
|
||||||
Container *ct;
|
Container *ct;
|
||||||
|
|
||||||
if (!prm[0])
|
if (!prm[0])
|
||||||
{
|
_ContainersNewName(prm, sizeof(prm), "_IB_");
|
||||||
num = LIST_GET_COUNT(&container_list);
|
|
||||||
Esnprintf(prm, sizeof(prm), "_IB_%i", num);
|
|
||||||
}
|
|
||||||
ct = _ContainerCreate(prm);
|
ct = _ContainerCreate(prm);
|
||||||
_ContainerShow(ct);
|
_ContainerShow(ct);
|
||||||
_ContainersConfigSave();
|
_ContainersConfigSave();
|
||||||
|
|
Loading…
Reference in New Issue