]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
Output errors if theme loading failed.
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Wed, 6 Apr 2011 11:00:18 +0000 (13:00 +0200)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Wed, 6 Apr 2011 11:00:18 +0000 (13:00 +0200)
* grub-core/gfxmenu/gfxmenu.c (grub_gfxmenu_try): Move the call to
grub_gfxterm_fullscreen on error paths to ...
* grub-core/normal/menu.c (menu_init): ...here. Wait after showing
theme loading error.

ChangeLog
grub-core/gfxmenu/gfxmenu.c
grub-core/normal/menu.c

index a657807bd7efc3f20c07cf4a0fe716ea1cc21448..891853f710b619a08727c907a5fee43b5463f0e0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2011-04-06  Vladimir Serbinenko  <phcoder@gmail.com>
+
+       Output errors if theme loading failed.
+
+       * grub-core/gfxmenu/gfxmenu.c (grub_gfxmenu_try): Move the call to
+       grub_gfxterm_fullscreen on error paths to ...
+       * grub-core/normal/menu.c (menu_init): ...here. Wait after showing
+       theme loading error.
+
 2011-04-06  Vladimir Serbinenko  <phcoder@gmail.com>
 
        * include/grub/offsets.h (GRUB_KERNEL_I386_PC_RAW_SIZE): Let a bit more
index 76d83c44b52015668b33760fa3dde8793973c88e..564a87634d79a232c0b1a700ecf87d2f913dcbcb 100644 (file)
@@ -56,30 +56,15 @@ grub_gfxmenu_try (int entry, grub_menu_t menu, int nested)
 
   theme_path = grub_env_get ("theme");
   if (! theme_path)
-    {
-      grub_error_push ();
-      grub_gfxterm_fullscreen ();
-      grub_error_pop ();
-      return grub_error (GRUB_ERR_FILE_NOT_FOUND, "no theme specified");
-    }
+    return grub_error (GRUB_ERR_FILE_NOT_FOUND, "no theme specified");
 
   instance = grub_zalloc (sizeof (*instance));
   if (!instance)
-    {
-      grub_error_push ();
-      grub_gfxterm_fullscreen ();
-      grub_error_pop ();
-      return grub_errno;
-    }
+    return grub_errno;
 
   err = grub_video_get_info (&mode_info);
   if (err)
-    {
-      grub_error_push ();
-      grub_gfxterm_fullscreen ();
-      grub_error_pop ();
-      return err;
-    }
+    return err;
 
   if (!cached_view || grub_strcmp (cached_view->theme_path, theme_path) != 0
       || cached_view->screen.width != mode_info.width
@@ -94,9 +79,6 @@ grub_gfxmenu_try (int entry, grub_menu_t menu, int nested)
   if (! cached_view)
     {
       grub_free (instance);
-      grub_error_push ();
-      grub_gfxterm_fullscreen ();
-      grub_error_pop ();
       return grub_errno;
     }
 
index e62482122f87b03803a2d81a6d4033e0078f22a2..bfcdd0ac5379e74002e3e40d35113771b69a46ca 100644 (file)
@@ -30,6 +30,7 @@
 #include <grub/i18n.h>
 #include <grub/term.h>
 #include <grub/script_sh.h>
+#include <grub/gfxterm.h>
 
 /* Time to delay after displaying an error message about a default/fallback
    entry failing to boot.  */
@@ -345,19 +346,45 @@ static void
 menu_init (int entry, grub_menu_t menu, int nested)
 {
   struct grub_term_output *term;
+  int gfxmenu = 0;
 
   FOR_ACTIVE_TERM_OUTPUTS(term)
-  {
-    grub_err_t err;
-
-    if (grub_gfxmenu_try_hook && grub_strcmp (term->name, "gfxterm") == 0)
+    if (grub_strcmp (term->name, "gfxterm") == 0)
       {
-       err = grub_gfxmenu_try_hook (entry, menu, nested);
-       if(!err)
-         continue;
+       if (grub_env_get ("theme"))
+         {
+           if (!grub_gfxmenu_try_hook)
+             {
+               grub_dl_load ("gfxmenu");
+               grub_print_error ();
+             }
+           if (grub_gfxmenu_try_hook)
+             {
+               grub_err_t err;
+               err = grub_gfxmenu_try_hook (entry, menu, nested);
+               if(!err)
+                 {
+                   gfxmenu = 1;
+                   break;
+                 }
+             }
+           else
+             grub_error (GRUB_ERR_BAD_MODULE, "no gfxmenu found");
+           grub_print_error ();
+           grub_wait_after_message ();
+         }
        grub_errno = GRUB_ERR_NONE;
+       grub_gfxterm_fullscreen ();
+       break;
       }
 
+  FOR_ACTIVE_TERM_OUTPUTS(term)
+  {
+    grub_err_t err;
+
+    if (grub_strcmp (term->name, "gfxterm") == 0 && gfxmenu)
+      break;
+
     err = grub_menu_try_text (term, entry, menu, nested);
     if(!err)
       continue;