2010-03-04 Robert Millan <rmh.grub@aybabtu.com>

Support relative image path in theme file.

	* gfxmenu/gui_image.c (grub_gui_image): New member theme_dir.
	(image_set_property): Handle theme_dir and relative path.
This commit is contained in:
Robert Millan 2010-03-04 23:16:34 +01:00 committed by Vladimir 'phcoder' Serbinenko
parent c7ef54aab1
commit d116e0d8d1
2 changed files with 30 additions and 2 deletions

View file

@ -1,3 +1,10 @@
2010-03-04 Robert Millan <rmh.grub@aybabtu.com>
Support relative image path in theme file.
* gfxmenu/gui_image.c (grub_gui_image): New member theme_dir.
(image_set_property): Handle theme_dir and relative path.
2010-03-04 Vladimir Serbinenko <phcoder@gmail.com> 2010-03-04 Vladimir Serbinenko <phcoder@gmail.com>
* configure.ac: Alias amd64 to x86_64. * configure.ac: Alias amd64 to x86_64.

View file

@ -31,6 +31,7 @@ struct grub_gui_image
grub_gui_container_t parent; grub_gui_container_t parent;
grub_video_rect_t bounds; grub_video_rect_t bounds;
char *id; char *id;
char *theme_dir;
struct grub_video_bitmap *raw_bitmap; struct grub_video_bitmap *raw_bitmap;
struct grub_video_bitmap *bitmap; struct grub_video_bitmap *bitmap;
}; };
@ -208,8 +209,28 @@ static grub_err_t
image_set_property (void *vself, const char *name, const char *value) image_set_property (void *vself, const char *name, const char *value)
{ {
grub_gui_image_t self = vself; grub_gui_image_t self = vself;
if (grub_strcmp (name, "file") == 0) if (grub_strcmp (name, "theme_dir") == 0)
return load_image (self, value); {
grub_free (self->theme_dir);
self->theme_dir = grub_strdup (value);
}
else if (grub_strcmp (name, "file") == 0)
{
char *absvalue;
grub_err_t err;
/* Resolve to an absolute path. */
if (! self->theme_dir)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "unspecified theme_dir");
absvalue = grub_resolve_relative_path (self->theme_dir, value);
if (! absvalue)
return grub_errno;
err = load_image (self, absvalue);
grub_free (absvalue);
return err;
}
else if (grub_strcmp (name, "id") == 0) else if (grub_strcmp (name, "id") == 0)
{ {
grub_free (self->id); grub_free (self->id);