31004e6
From e8aa1eb895298af57764ec03ff6df44a48b1f7d1 Mon Sep 17 00:00:00 2001
31004e6
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
31004e6
Date: Fri, 3 May 2013 14:08:51 +0200
f74b50e
Subject: [PATCH 410/482] 	* grub-core/gfxmenu/gfxmenu.c
31004e6
 (grub_gfxmenu_try): Allow specifying 	the theme path relative to
31004e6
 $prefix/themes.
31004e6
31004e6
---
31004e6
 ChangeLog                   |  5 +++++
31004e6
 grub-core/gfxmenu/gfxmenu.c | 17 +++++++++++++++--
31004e6
 2 files changed, 20 insertions(+), 2 deletions(-)
31004e6
31004e6
diff --git a/ChangeLog b/ChangeLog
31004e6
index c26b110..ed99c80 100644
31004e6
--- a/ChangeLog
31004e6
+++ b/ChangeLog
31004e6
@@ -1,5 +1,10 @@
31004e6
 2013-05-03  Vladimir Serbinenko  <phcoder@gmail.com>
31004e6
 
31004e6
+	* grub-core/gfxmenu/gfxmenu.c (grub_gfxmenu_try): Allow specifying
31004e6
+	the theme path relative to $prefix/themes.
31004e6
+
31004e6
+2013-05-03  Vladimir Serbinenko  <phcoder@gmail.com>
31004e6
+
31004e6
 	* grub-core/video/fb/fbblit.c (grub_video_fbblit_blend_BGR888_RGBA8888):
31004e6
 	Fix order bug.
31004e6
 	(grub_video_fbblit_blend_RGB888_RGBA8888): Likewise.
31004e6
diff --git a/grub-core/gfxmenu/gfxmenu.c b/grub-core/gfxmenu/gfxmenu.c
31004e6
index 09e8621..51110a6 100644
31004e6
--- a/grub-core/gfxmenu/gfxmenu.c
31004e6
+++ b/grub-core/gfxmenu/gfxmenu.c
31004e6
@@ -53,6 +53,7 @@ grub_gfxmenu_try (int entry, grub_menu_t menu, int nested)
31004e6
 {
31004e6
   grub_gfxmenu_view_t view = NULL;
31004e6
   const char *theme_path;
31004e6
+  char *full_theme_path = 0;
31004e6
   struct grub_menu_viewer *instance;
31004e6
   grub_err_t err;
31004e6
   struct grub_video_mode_info mode_info;
31004e6
@@ -70,15 +71,27 @@ grub_gfxmenu_try (int entry, grub_menu_t menu, int nested)
31004e6
   if (err)
31004e6
     return err;
31004e6
 
31004e6
-  if (!cached_view || grub_strcmp (cached_view->theme_path, theme_path) != 0
31004e6
+  if (theme_path[0] != '/' && theme_path[0] != '(')
31004e6
+    {
31004e6
+      const char *prefix;
31004e6
+      prefix = grub_env_get ("prefix");
31004e6
+      full_theme_path = grub_xasprintf ("%s/themes/%s",
31004e6
+					prefix,
31004e6
+					theme_path);
31004e6
+    }
31004e6
+
31004e6
+  if (!cached_view || grub_strcmp (cached_view->theme_path,
31004e6
+				   full_theme_path ? : theme_path) != 0
31004e6
       || cached_view->screen.width != mode_info.width
31004e6
       || cached_view->screen.height != mode_info.height)
31004e6
     {
31004e6
       grub_free (cached_view);
31004e6
       /* Create the view.  */
31004e6
-      cached_view = grub_gfxmenu_view_new (theme_path, mode_info.width,
31004e6
+      cached_view = grub_gfxmenu_view_new (full_theme_path ? : theme_path,
31004e6
+					   mode_info.width,
31004e6
 					   mode_info.height);
31004e6
     }
31004e6
+  grub_free (full_theme_path);
31004e6
 
31004e6
   if (! cached_view)
31004e6
     {
31004e6
-- 
31004e6
1.8.2.1
31004e6