Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1MJgFD-00075I-El for mharc-grub-devel@gnu.org; Thu, 25 Jun 2009 00:07:27 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MJgFB-00072U-KQ for grub-devel@gnu.org; Thu, 25 Jun 2009 00:07:25 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MJgF6-0006yh-Vd for grub-devel@gnu.org; Thu, 25 Jun 2009 00:07:25 -0400 Received: from [199.232.76.173] (port=59547 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MJgF6-0006yY-Rt for grub-devel@gnu.org; Thu, 25 Jun 2009 00:07:20 -0400 Received: from mail-px0-f176.google.com ([209.85.216.176]:62207) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MJgF6-0003jc-Cy for grub-devel@gnu.org; Thu, 25 Jun 2009 00:07:20 -0400 Received: by pxi6 with SMTP id 6so1088146pxi.14 for ; Wed, 24 Jun 2009 21:07:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type:content-transfer-encoding; bh=5aJnMjjRbsZK0JML8Jj47aSVt0+kz3tzth6gNtq7RFE=; b=ZJ0LXnM0jTjr7X1lfCySNytjlihzKHJmKuzPszxTGIqZ6IWZTelnNTJB9F+7Lurl2Z SrMwhe9vBtWhYvcsFJ4RvlRZE0wWXUWZG0SRzog56hx6VDfXR1EyWkBLxICwr0U/R8Lg R1OA08+sCf0beeZX2HKrlsBfXJsVnIZHvJNQQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type :content-transfer-encoding; b=rudyRqZQFbd9M+9Y/ho2rCZdve5UnTBCxD+S1m/pN2XsTH2ilhHRQjLM/x9HCo2fvn jJAk4LSyNAAyO7zlUMoHuT4dfsjbXX4QjW0otR7OOXxMkHLbHFCJoGDHzGkspzjc8Z4G owtkDnZVveu71t3c+wH2nlEQ0IEO3VfplizG4= MIME-Version: 1.0 Received: by 10.115.94.4 with SMTP id w4mr3141808wal.153.1245902838784; Wed, 24 Jun 2009 21:07:18 -0700 (PDT) Date: Thu, 25 Jun 2009 12:07:18 +0800 Message-ID: From: Bean To: The development of GRUB 2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Subject: [RFC] New menu design based on MVC X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 04:07:25 -0000 Hi, The current menu system is a little chaotic, the various components are mixed together which make it difficult to maintain and extend. Therefore, I propose a new design which seperates model, view and controller. Model. It's the menu items. Currently, menu are added using menuitem statement, which is unique to sh script engine. I think it'd be advantageous to have a scipt independent way to define menu. Also, using configfile to define submenu is not good, as it is difficult to implement interaction between parent and child menu, for example, auto expand the child menu when parent is selected, or implement a hotkey that will jump back to the top menu regardless of the current menu level. IMO, the menu should be loaded as a whole. The menu is tree structure, a natural way to represent it is to use xml, for example, we may write it like this: root (hd0,1) chainloader +1 root (hd0,2) linux /vmlinuz initrd /initrd.img We can add a command load_menu to load it. View. It's the menu viewer. Currently, the menu viewer resides in normal.mod, but it should be placed in a standalone module. Also, besides the current c version, we could add a new one written in lua. LUA script is quite flexible, we can extend the function of menu viewer without recompiling from source code. Another improvement of menu viewer is to define the layout dynamically, instead of hardcoding them in the source. And again, we could utilize the xml to define the layout, perhaps something like this: Controller. Currenlt, the controller is mixed with viewer, the show_menu function of menu viewer takes over once it's invoked. I think it's better to move this part out of viewer. In fact, we can implement this using event model. The controller waits for events, such as keyboard, timer, etc, and then dispatch them to the viewer. -- Bean