+/**
+ * cui_on_open - Open new item callback.
+ */
+
+void cui_on_open(struct pmenu *menu)
+{
+ unsigned int insert_pt;
+ struct pmenu_item *i;
+ struct cui_opt_data *cod;
+
+ menu->scr.unpost(&menu->scr);
+
+ /* This disconnects items array from menu. */
+
+ set_menu_items(menu->ncm, NULL);
+
+ /* Insert new items at insert_pt. */
+
+ insert_pt = pmenu_grow(menu, 1);
+ i = pmenu_item_alloc(menu);
+
+ i->on_edit = cui_boot_editor_run;
+ i->on_execute = cui_boot;
+ i->data = cod = talloc_zero(i, struct cui_opt_data);
+
+ cod->name = talloc_asprintf(i, "User item %u:", insert_pt);
+ cod->bd = talloc_zero(i, struct pb_boot_data);
+
+ pmenu_item_setup(menu, i, insert_pt, talloc_strdup(i, cod->name));
+
+ /* Re-attach the items array. */
+
+ set_menu_items(menu->ncm, menu->items);
+
+ menu->scr.post(&menu->scr);
+ set_current_item(menu->ncm, i->nci);
+
+ i->on_edit(i);
+}
+