Mercurial > mplayer.hg
diff libmenu/vf_menu.c @ 37032:4c7ab9a4f3cd
vf_menu: try to make code more straight-forward.
author | reimar |
---|---|
date | Sun, 06 Apr 2014 17:57:33 +0000 |
parents | fbe5c829c69b |
children |
line wrap: on
line diff
--- a/libmenu/vf_menu.c Sun Apr 06 17:56:13 2014 +0000 +++ b/libmenu/vf_menu.c Sun Apr 06 17:57:33 2014 +0000 @@ -103,16 +103,14 @@ return 1; } case MP_CMD_SET_MENU : { - char* menu = cmd->args[0].v.s; - menu_t* l = priv->current; - priv->current = menu_open(menu); - if(!priv->current) { + const char *menu = cmd->args[0].v.s; + menu_t *new = menu_open(menu); + priv->current->show = new != NULL; + if (new) { + new->parent = priv->current; + priv->current = new; + } else { mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_FailedToOpenMenu,menu); - priv->current = l; - priv->current->show = 0; - } else { - priv->current->show = 1; - priv->current->parent = l; } return 1; }