Blame SOURCES/0410-grub-core-gfxmenu-gfxmenu.c-grub_gfxmenu_try-Allow-s.patch

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