changeset 27072:15b870cf3592

Add auto-close option to libmenu playlist handling part.
author ben
date Fri, 20 Jun 2008 19:43:19 +0000
parents 5cafd67e6c90
children d2b26c92559d
files libmenu/menu_pt.c
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libmenu/menu_pt.c	Fri Jun 20 19:33:32 2008 +0000
+++ b/libmenu/menu_pt.c	Fri Jun 20 19:43:19 2008 +0000
@@ -32,11 +32,13 @@
 struct menu_priv_s {
   menu_list_priv_t p;
   char* title;
+  int auto_close;
 };
 
 static struct menu_priv_s cfg_dflt = {
   MENU_LIST_PRIV_DFLT,
-  "Jump to"
+  "Jump to",
+  0
 };
 
 #define ST_OFF(m) M_ST_OFF(struct menu_priv_s,m)
@@ -44,6 +46,7 @@
 static m_option_t cfg_fields[] = {
   MENU_LIST_PRIV_FIELDS,
   { "title", ST_OFF(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 }
 };
 
@@ -85,8 +88,11 @@
       snprintf(str,15,"pt_step %d",d);
     }
     c = mp_input_parse_cmd(str);
-    if(c)
+    if(c) {
+      if(mpriv->auto_close)
+        mp_input_queue_cmd(mp_input_parse_cmd("menu hide"));
       mp_input_queue_cmd(c);
+    }
     else
       mp_msg(MSGT_GLOBAL,MSGL_WARN,MSGTR_LIBMENU_FailedToBuildCommand,str);
   } break;