1 /* menu.h - Menu model function prototypes and data structures. */
3 * GRUB -- GRand Unified Bootloader
4 * Copyright (C) 2009 Free Software Foundation, Inc.
6 * GRUB is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * GRUB is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
20 #ifndef GRUB_MENU_HEADER
21 #define GRUB_MENU_HEADER 1
23 struct grub_menu_entry_class
26 struct grub_menu_entry_class
*next
;
30 struct grub_menu_entry
35 /* If set means not everybody is allowed to boot this entry. */
41 /* The classes associated with the menu entry:
42 used to choose an icon or other style attributes.
43 This is a dummy head node for the linked list, so for an entry E,
44 E.classes->next is the first class if it is not NULL. */
45 struct grub_menu_entry_class
*classes
;
47 /* The sourcecode of the menu entry, used by the editor. */
48 const char *sourcecode
;
50 /* The next element. */
51 struct grub_menu_entry
*next
;
53 typedef struct grub_menu_entry
*grub_menu_entry_t
;
58 /* The size of a menu. */
61 /* The list of menu entries. */
62 grub_menu_entry_t entry_list
;
64 typedef struct grub_menu
*grub_menu_t
;
66 /* Callback structure menu viewers can use to provide user feedback when
67 default entries are executed, possibly including fallback entries. */
68 typedef struct grub_menu_execute_callback
70 /* Called immediately before ENTRY is booted. */
71 void (*notify_booting
) (grub_menu_entry_t entry
, void *userdata
);
73 /* Called when executing one entry has failed, and another entry, ENTRY, will
74 be executed as a fallback. The implementation of this function should
75 delay for a period of at least 2 seconds before returning in order to
76 allow the user time to read the information before it can be lost by
78 void (*notify_fallback
) (grub_menu_entry_t entry
, void *userdata
);
80 /* Called when an entry has failed to execute and there is no remaining
81 fallback entry to attempt. */
82 void (*notify_failure
) (void *userdata
);
84 *grub_menu_execute_callback_t
;
87 grub_menu_entry_t
grub_menu_get_entry (grub_menu_t menu
, int no
);
88 int grub_menu_get_timeout (void);
89 void grub_menu_set_timeout (int timeout
);
90 void grub_menu_execute_entry (grub_menu_entry_t entry
);
91 void grub_menu_execute_with_fallback (grub_menu_t menu
,
92 grub_menu_entry_t entry
,
93 grub_menu_execute_callback_t callback
,
95 void grub_menu_entry_run (grub_menu_entry_t entry
);
97 #endif /* GRUB_MENU_HEADER */