static WMPropList *processSubmenu(WEditMenu * menu) { WEditMenuItem *item; WMPropList *pmenu; WMPropList *pl; char *s; int i; s = WGetEditMenuTitle(menu); pl = WMCreatePLString(s); pmenu = WMCreatePLArray(pl, NULL); i = 0; while ((item = WGetEditMenuItem(menu, i++))) { WEditMenu *submenu; s = WGetEditMenuItemTitle(item); submenu = WGetEditMenuSubmenu(item); if (submenu) { pl = processSubmenu(submenu); } else { pl = processData(s, WGetEditMenuItemData(item)); } if (!pl) continue; WMAddToPLArray(pmenu, pl); } return pmenu; }
static Bool shouldRemoveItem(struct WEditMenuDelegate *delegate, WEditMenu * menu, WEditMenuItem * item) { _Panel *panel = (_Panel *) delegate->data; if (panel->dontAsk) return True; if (WGetEditMenuSubmenu(item)) { int res; res = WMRunAlertPanel(WMWidgetScreen(menu), NULL, _("Remove Submenu"), _("Removing this item will destroy all items inside\n" "the submenu. Do you really want to do that?"), _("Yes"), _("No"), _("Yes, don't ask again")); switch (res) { case WAPRDefault: return True; case WAPRAlternate: return False; case WAPROther: panel->dontAsk = True; return True; } } return True; }
static void menuItemEdited(struct WEditMenuDelegate *delegate, WEditMenu *menu, WEditMenuItem *item) { _Panel *panel = (_Panel*)delegate->data; WEditMenu *submenu; updateFrameTitle(panel, WGetEditMenuItemTitle(item), panel->currentType); submenu = WGetEditMenuSubmenu(menu, item); if (submenu) { WSetEditMenuTitle(submenu, WGetEditMenuItemTitle(item)); } }
static void menuItemEdited(struct WEditMenuDelegate *delegate, WEditMenu * menu, WEditMenuItem * item) { _Panel *panel = (_Panel *) delegate->data; WEditMenu *submenu; /* Parameter not used, but tell the compiler it is ok */ (void) menu; updateFrameTitle(panel, WGetEditMenuItemTitle(item), panel->currentType); submenu = WGetEditMenuSubmenu(item); if (submenu) { WSetEditMenuTitle(submenu, WGetEditMenuItemTitle(item)); } }