commit - 41f5e3dc26832b5d8a7e55de9270815303879e9b
commit + e6d4f160537b96bd299f8975cfe3e0af22360d10
blob - 5f3f825d0e7a4c9fa6585a849631da64e1881ec1
blob + dcc0c096eba1f44b44cb8e8fc415722d40534334
--- siomixer.c
+++ siomixer.c
if (d == NULL)
return;
+ if (s.flowbox)
+ gtk_flow_box_remove_all(GTK_FLOW_BOX(s.flowbox));
+
/*
* delete control
*/
for (pi = &s.infolist; (i = *pi) != NULL; pi = &i->next) {
if (d->addr == i->desc.addr) {
*pi = i->next;
- /* XXX: free removed widgets */
+ if (i->widget) {
+ audiowidget_free(i->widget);
+ }
free(i);
break;
}
case SIOCTL_VEC:
case SIOCTL_LIST:
case SIOCTL_SEL:
+ /*
+ * find the right position to insert the new widget
+ */
+ for (pi = &s.infolist; (i = *pi) != NULL; pi = &i->next) {
+ cmp = cmpdesc(d, &i->desc);
+ if (cmp <= 0)
+ break;
+ }
+ i = malloc(sizeof(struct info));
+ if (i == NULL) {
+ perror("malloc");
+ exit(1);
+ }
+ i->desc = *d;
+ printf("new node: %s %s %s %d\n", i->desc.group, i->desc.node0.name, i->desc.func, i->desc.node0.unit);
+ i->ctladdr = d->addr;
+ i->curval = i->newval = curval;
+ i->mode = MODE_IGNORE;
+ i->next = *pi;
+ i->timeout = 0;
+ i->widget = NULL;
+ if(s.flowbox && i->desc.node0.unit < 1)
+ i->widget = audiowidget_new(i);
+ *pi = i;
break;
- case SIOCTL_NONE:
- gtk_flow_box_remove_all(GTK_FLOW_BOX(s.flowbox));
- /* XXX: free removed widgets */
+ default:
+ break;
+ }
+
+ /* Reconstruct flow_box */
+ if (s.flowbox) {
for (i = s.infolist; i != NULL; i = nextfunc(i)) {
- i->widget = audiowidget_new(i);
if (i->widget) {
gtk_flow_box_append(GTK_FLOW_BOX(s.flowbox),
audiowidget_get_gtkwidget(i->widget));
}
}
- /* fallthrough */
- default:
- return;
}
-
- /*
- * find the right position to insert the new widget
- */
- for (pi = &s.infolist; (i = *pi) != NULL; pi = &i->next) {
- cmp = cmpdesc(d, &i->desc);
- if (cmp <= 0)
- break;
- }
- i = malloc(sizeof(struct info));
- if (i == NULL) {
- perror("malloc");
- exit(1);
- }
- i->desc = *d;
- i->ctladdr = d->addr;
- i->curval = i->newval = curval;
- i->mode = MODE_IGNORE;
- i->next = *pi;
- i->timeout = 0;
- i->widget = NULL;
-
- /* Add widget and link to list */
- if (s.flowbox) {
- i->widget = audiowidget_new(i);
- if (i->widget) {
- gtk_flow_box_append(GTK_FLOW_BOX(s.flowbox),
- audiowidget_get_gtkwidget(i->widget));
- }
- }
-
- *pi = i;
}
/*