Hello 2009/10/17 Bean <bean12...@gmail.com>: > Hi, > > Update: > > Add sub menu support, generate widgets dynamically using menu entries.
The example is very complex and I don't quite understand what is the advantage of this baroque scheme over generating the menus in grub.d in files like 00_header or 10_linux. For example, each menuentry for loading a linux kernel is generated by a function in 10_linux which in turn calls functions from grub-mkconfig_lib. Thus it is possible to create arbitrarily complex menu entries without additional C code in grub or user-edited configuration. I don't see why these shell scripts cannot include all the panels and stuff needed for the new menu and have to be generated by C code in grub. > > Now grub.cfg should look like this: > > menuentry "AAA" { > set root=(hd0,1) > chainloader +1 > } > > menuentry "BBB" --class ubuntu { > true > } > > . /menu/menu.cfg > > The menu have three items, AAA, BBB and Tools, which is a menu > appended in menu.cfg. > > Tools are a submenu, its content is defined using menu section: > > menu { > Tools { > "Toggle Mode" { > command = menu_toggle_mode > } > > "Terminal" { > command = "menu_popup term_window" > } > > "Change Theme" { > Default { > command="load_config /menu/blue.txt\nmenu_refresh" > } > > Green { > command="load_config /menu/green.txt\nmenu_refresh" > } > > White { > command="load_config /menu/white.txt\nmenu_refresh" > } > } > > "Layout Demo" { > command = "menu_popup layout_test" > } > > Halt { > command = "halt" > } > > Reboot { > command = "reboot" > } > } > } > > merge_config command would append this with user defined menu items. > > The screen section is very simple now: > > screen { > panel { > extend = 1 > valign = center > halign = center > > panel { > class = frame > id = __menu__ > } > } > } So you invent a new property here just to bind the menu to a panel. If you insist then screen should be a panel { id = __screen__ }. > > command menu_create would scan screen for id __menu__, and add widgets > according to the menu content. The generated widget entry looks like > this: > > panel > { > class = select > command = COMMAND > image { class = CLASS } > text { text = TITLE } > } And if I want a slightly different structure I have to patch and recompile grub. I also wonder how do you specify the image bitmap here because it's the sole content of the image so it should not be specified by style. > > The submenu is this: > > panel > { > class = frame > command = "menu_popup -r menu_tree N" > } > I have no idea what the above is supposed to mean. Care to explain? Thanks Michal _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org http://lists.gnu.org/mailman/listinfo/grub-devel