[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Idea: use menu hook to implement the savedefault command
From: |
Javier Martín |
Subject: |
Re: Idea: use menu hook to implement the savedefault command |
Date: |
Wed, 13 Aug 2008 13:36:44 +0200 |
El mié, 13-08-2008 a las 12:31 +0200, Marco Gerards escribió:
> Bean <address@hidden> writes:
>
> > Hi,
> >
> > Now it's possible to implement savedefault with load_env and save_env,
> > but the problem is we need to add it to every menuitem, it's tedious
> > process, and new item don't get it automatically.
> >
> > I'm thinking about using menu hook to solve this. I can think of two
> > implementation:
> >
> > 1. Function interface
> >
> > We can install hooks, which get called just before the menu is invoked.
> >
> > 2. Script interface
> >
> > We can use certain variable to specific the command to use, for example:
> >
> > set MENU_PRELOAD=save_env default
>
> Wouldn't this be a BOOT_PRELOAD?
>
> I thought about this before (see archives about scripting), making it
> possible for the user to add hooks.
>
> In C:
>
> ... menu code ...
> /* The `menu' hook has one argument. */
> grub_hook_invoke ("menu", 1, arglist);
>
>
> In scripting:
>
> function menu_hook_handler()
> save_env;
>
> hook --register --hook=menu --script menu_hook_handler
>
> Or do you think I am crazy now? ;-)
>
> This will involve some scripting hacking, but might pay off. Do you
> think this is too complex for users?
It might be unnecessarily complex, yes. What about a C#-delegate-like
approach? e.g.:
function myhook() {
save_env
}
BOOT_PRELOAD += myhook
>
>
>
>
> _______________________________________________
> Grub-devel mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/grub-devel
signature.asc
Description: Esta parte del mensaje está firmada digitalmente
- Idea: use menu hook to implement the savedefault command, (continued)
- Idea: use menu hook to implement the savedefault command, Bean, 2008/08/11
- Re: Idea: use menu hook to implement the savedefault command, Robert Millan, 2008/08/11
- Re: Idea: use menu hook to implement the savedefault command, Bean, 2008/08/11
- Re: Idea: use menu hook to implement the savedefault command, Robert Millan, 2008/08/12
- Re: Idea: use menu hook to implement the savedefault command, Bean, 2008/08/12
- Re: Idea: use menu hook to implement the savedefault command, Robert Millan, 2008/08/12
- Re: Idea: use menu hook to implement the savedefault command, Bean, 2008/08/12
- Re: Idea: use menu hook to implement the savedefault command, Robert Millan, 2008/08/12
- Re: Idea: use menu hook to implement the savedefault command, Bean, 2008/08/12
- Re: Idea: use menu hook to implement the savedefault command, Marco Gerards, 2008/08/13