changeset 18819:cd0491dc2afa

support for auto_close parameter in menu command list (geexbox patch)
author ben
date Sun, 25 Jun 2006 21:24:46 +0000
parents ab94d003023d
children 1ff5eeb87dce
files libmenu/menu_cmdlist.c
diffstat 1 files changed, 10 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libmenu/menu_cmdlist.c	Sun Jun 25 21:16:52 2006 +0000
+++ b/libmenu/menu_cmdlist.c	Sun Jun 25 21:24:46 2006 +0000
@@ -35,15 +35,20 @@
 
 struct menu_priv_s {
   menu_list_priv_t p;
+  int auto_close;
 };
 
+#define ST_OFF(m) M_ST_OFF(struct menu_priv_s, m)
+
 static struct menu_priv_s cfg_dflt = {
-  MENU_LIST_PRIV_DFLT
+  MENU_LIST_PRIV_DFLT,
+  0,
 };
 
 static m_option_t cfg_fields[] = {
   MENU_LIST_PRIV_FIELDS,
   { "title",M_ST_OFF(struct menu_priv_s,p.title), CONF_TYPE_STRING, 0, 0, 0, NULL },
+  { "auto-close", ST_OFF(auto_close), CONF_TYPE_FLAG, 0, 0, 1, NULL },
   { NULL, NULL, NULL, 0,0,0,NULL }
 };
 
@@ -61,7 +66,11 @@
     if(mpriv->p.current->ok) {
       mp_cmd_t* c = mp_input_parse_cmd(mpriv->p.current->ok);
       if(c)
+        {
+          if (mpriv->auto_close)
+              mp_input_queue_cmd (mp_input_parse_cmd ("menu hide"));
 	mp_input_queue_cmd(c);
+        }
     }
    } break;
   case MENU_CMD_LEFT: