Mercurial > mplayer.hg
comparison libmenu/menu.c @ 25208:1b3dabc8c2b8
Add type info to menu_t, now we can get the menu name and the type name of menu.
author | ulion |
---|---|
date | Sun, 02 Dec 2007 11:14:50 +0000 |
parents | f01f7cc2b694 |
children | 96d0992c7920 |
comparison
equal
deleted
inserted
replaced
25207:21d672c608ef | 25208:1b3dabc8c2b8 |
---|---|
44 #endif | 44 #endif |
45 &menu_info_pref, | 45 &menu_info_pref, |
46 NULL | 46 NULL |
47 }; | 47 }; |
48 | 48 |
49 typedef struct menu_def_st { | 49 struct menu_def_st { |
50 char* name; | 50 char* name; |
51 menu_info_t* type; | 51 menu_info_t* type; |
52 void* cfg; | 52 void* cfg; |
53 char* args; | 53 char* args; |
54 } menu_def_t; | 54 }; |
55 | 55 |
56 static struct MPContext *menu_ctx = NULL; | 56 static struct MPContext *menu_ctx = NULL; |
57 static menu_def_t* menu_list = NULL; | 57 static menu_def_t* menu_list = NULL; |
58 static int menu_count = 0; | 58 static int menu_count = 0; |
59 | 59 |
218 } | 218 } |
219 m = calloc(1,sizeof(menu_t)); | 219 m = calloc(1,sizeof(menu_t)); |
220 m->priv_st = &(menu_list[i].type->priv_st); | 220 m->priv_st = &(menu_list[i].type->priv_st); |
221 m->priv = m_struct_copy(m->priv_st,menu_list[i].cfg); | 221 m->priv = m_struct_copy(m->priv_st,menu_list[i].cfg); |
222 m->ctx = menu_ctx; | 222 m->ctx = menu_ctx; |
223 m->type = &menu_list[i]; | |
223 if(menu_list[i].type->open(m,menu_list[i].args)) | 224 if(menu_list[i].type->open(m,menu_list[i].args)) |
224 return m; | 225 return m; |
225 if(m->priv) | 226 if(m->priv) |
226 m_struct_free(m->priv_st,m->priv); | 227 m_struct_free(m->priv_st,m->priv); |
227 free(m); | 228 free(m); |