2009-12-19 Carles Pina i Estany <carles@pina.cat>
* include/grub/normal.h (grub_utf8_to_ucs4): New declaration. (grub_print_ucs4_alloc): Likewise. (grub_getstringwidth): Likewise. * normal/main.c (grub_normal_init_page): Gettextize version string. * normal/menu_text.c (grub_utf8_to_ucs4_alloc): New definition. (getstringwidth): Renamed to ... (grub_getstringwidth): ... this. Remove `static' qualifier (now used in normal/main.c). Use `grub_utf8_to_ucs4_alloc'. (grub_print_ucs4): Remove `static' qualifer (now used in normal/main.c). * po/POTFILES: Add normal/main.c.
This commit is contained in:
parent
bfd5e52b1d
commit
b99518d1ce
5 changed files with 79 additions and 30 deletions
|
@ -385,22 +385,35 @@ read_config_file (const char *config)
|
|||
void
|
||||
grub_normal_init_page (void)
|
||||
{
|
||||
grub_uint8_t width, margin;
|
||||
|
||||
#define TITLE ("GNU GRUB version " PACKAGE_VERSION)
|
||||
|
||||
width = grub_getwh () >> 8;
|
||||
margin = (width - (sizeof(TITLE) + 7)) / 2;
|
||||
int msg_len;
|
||||
int posx;
|
||||
const char *msg = _("GNU GRUB version %s");
|
||||
|
||||
char *msg_formatted = grub_malloc (grub_strlen(msg) +
|
||||
grub_strlen(PACKAGE_VERSION));
|
||||
|
||||
grub_cls ();
|
||||
grub_putchar ('\n');
|
||||
|
||||
while (margin--)
|
||||
grub_putchar (' ');
|
||||
grub_sprintf (msg_formatted, msg, PACKAGE_VERSION);
|
||||
|
||||
grub_printf ("%s\n\n", TITLE);
|
||||
grub_uint32_t *unicode_msg;
|
||||
grub_uint32_t *last_position;
|
||||
|
||||
msg_len = grub_utf8_to_ucs4_alloc (msg_formatted,
|
||||
&unicode_msg, &last_position);
|
||||
|
||||
if (msg_len < 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
#undef TITLE
|
||||
posx = grub_getstringwidth (unicode_msg, last_position);
|
||||
posx = (GRUB_TERM_WIDTH - posx) / 2;
|
||||
grub_gotoxy (posx, 1);
|
||||
|
||||
grub_print_ucs4 (unicode_msg, last_position);
|
||||
grub_printf("\n\n");
|
||||
grub_free (unicode_msg);
|
||||
}
|
||||
|
||||
static int reader_nested;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue