* [PATCH] gfxmenu relative path in "file" component of images
@ 2010-01-20 22:37 Robert Millan
2010-01-20 22:51 ` Vladimir 'φ-coder/phcoder' Serbinenko
0 siblings, 1 reply; 2+ messages in thread
From: Robert Millan @ 2010-01-20 22:37 UTC (permalink / raw)
To: grub-devel
[-- Attachment #1: Type: text/plain, Size: 266 bytes --]
This makes it possible to use relative paths in the "file" component of
gfxmenu images. I've tested that it works, but I'd appreciate if someone
more familiar with gfxmenu can review it.
--
Robert Millan
"Be the change you want to see in the world" -- Gandhi
[-- Attachment #2: gfxmenu_relpath.diff --]
[-- Type: text/x-diff, Size: 987 bytes --]
=== modified file 'gfxmenu/gui_image.c'
--- gfxmenu/gui_image.c 2009-12-29 16:31:02 +0000
+++ gfxmenu/gui_image.c 2010-01-20 21:18:38 +0000
@@ -207,9 +207,25 @@ load_image (grub_gui_image_t self, const
static grub_err_t
image_set_property (void *vself, const char *name, const char *value)
{
+ static const char *theme_dir = NULL;
grub_gui_image_t self = vself;
- if (grub_strcmp (name, "file") == 0)
- return load_image (self, value);
+ if (grub_strcmp (name, "theme_dir") == 0)
+ {
+ theme_dir = value;
+ }
+ else if (grub_strcmp (name, "file") == 0)
+ {
+ char *absvalue;
+
+ /* Resolve to an absolute path. */
+ if (! theme_dir)
+ return grub_error (GRUB_ERR_BAD_ARGUMENT, "unspecified theme_dir");
+ absvalue = grub_resolve_relative_path (theme_dir, value);
+ if (! absvalue)
+ return grub_errno;
+
+ return load_image (self, absvalue);
+ }
else if (grub_strcmp (name, "id") == 0)
{
grub_free (self->id);
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] gfxmenu relative path in "file" component of images
2010-01-20 22:37 [PATCH] gfxmenu relative path in "file" component of images Robert Millan
@ 2010-01-20 22:51 ` Vladimir 'φ-coder/phcoder' Serbinenko
0 siblings, 0 replies; 2+ messages in thread
From: Vladimir 'φ-coder/phcoder' Serbinenko @ 2010-01-20 22:51 UTC (permalink / raw)
To: The development of GNU GRUB
[-- Attachment #1: Type: text/plain, Size: 795 bytes --]
Robert Millan wrote:
> This makes it possible to use relative paths in the "file" component of
> gfxmenu images. I've tested that it works, but I'd appreciate if someone
> more familiar with gfxmenu can review it.
>
+ static const char *theme_dir = NULL;
Add a member to grub_gui_image_t rather than using a static variable
+ theme_dir = value;
Use appropriate grub_strdup and free in _destroy function.
+ return load_image (self, absvalue);
absvalue isn't freeed
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/grub-devel
--
Regards
Vladimir 'φ-coder/phcoder' Serbinenko
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 293 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-01-20 22:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-20 22:37 [PATCH] gfxmenu relative path in "file" component of images Robert Millan
2010-01-20 22:51 ` Vladimir 'φ-coder/phcoder' Serbinenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox