All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC][PATCH] [1/2] remove outdated code
@ 2013-04-26 13:02 Vladimir Testov
  0 siblings, 0 replies; only message in thread
From: Vladimir Testov @ 2013-04-26 13:02 UTC (permalink / raw)
  To: grub-devel

[-- Attachment #1: Type: text/plain, Size: 186 bytes --]

Hi folks,

There is some oudated and unused code.

I suggest we should remove it.

-- 
With best regards,
_______________________________
Vladimir Testov, ROSA Laboratory.
www.rosalab.ru

[-- Attachment #2: grub-remove-outdated-code.patch --]
[-- Type: text/x-patch, Size: 8428 bytes --]

diff -Naur grub-new3/docs/grub.texi grub-new4/docs/grub.texi
--- grub-new3/docs/grub.texi	2013-04-19 03:55:05.000000000 +0400
+++ grub-new4/docs/grub.texi	2013-04-26 11:58:20.041859276 +0400
@@ -1898,9 +1898,6 @@
 @item title-text @tab Specifies the text to display at the top center of the screen as a title.
 @item title-font @tab Defines the font used for the title message at the top of the screen.
 @item title-color @tab Defines the color of the title message.
-@item message-font @tab Defines the font used for messages, such as when GRUB is unable to automatically boot an entry.
-@item message-color @tab Defines the color of the message text.
-@item message-bg-color @tab Defines the background color of the message text area.
 @item desktop-image @tab Specifies the image to use as the background.  It will be scaled to fit the screen size.
 @item desktop-color @tab Specifies the color for the background if *desktop-image* is not specified.
 @item terminal-box @tab Specifies the file name pattern for the styled box slices used for the command line terminal window.  For example, ``terminal-box: terminal_*.png'' will use the images ``terminal_c.png`` as the center area, ``terminal_n.png`` as the north (top) edge, ``terminal_nw.png`` as the northwest (upper left) corner, and so on.  If the image for any slice is not found, it will simply be left empty.
diff -Naur grub-new3/grub-core/gfxmenu/theme_loader.c grub-new4/grub-core/gfxmenu/theme_loader.c
--- grub-new3/grub-core/gfxmenu/theme_loader.c	2013-02-25 16:54:27.000000000 +0400
+++ grub-new4/grub-core/gfxmenu/theme_loader.c	2013-04-24 12:50:05.143117525 +0400
@@ -126,7 +126,7 @@
   if (! grub_strcmp ("title-font", name))
     view->title_font = grub_font_get (value);
   else if (! grub_strcmp ("message-font", name))
-    view->message_font = grub_font_get (value);
+    return GRUB_ERR_NONE;
   else if (! grub_strcmp ("terminal-font", name))
     {
       grub_free (view->terminal_font_name);
@@ -137,9 +137,9 @@
   else if (! grub_strcmp ("title-color", name))
     grub_video_parse_color (value, &view->title_color);
   else if (! grub_strcmp ("message-color", name))
-    grub_video_parse_color (value, &view->message_color);
+    return GRUB_ERR_NONE;
   else if (! grub_strcmp ("message-bg-color", name))
-    grub_video_parse_color (value, &view->message_bg_color);
+    return GRUB_ERR_NONE;
   else if (! grub_strcmp ("desktop-image", name))
     {
       struct grub_video_bitmap *raw_bitmap;
diff -Naur grub-new3/grub-core/gfxmenu/view.c grub-new4/grub-core/gfxmenu/view.c
--- grub-new3/grub-core/gfxmenu/view.c	2013-04-08 13:00:36.000000000 +0400
+++ grub-new4/grub-core/gfxmenu/view.c	2013-04-24 12:34:44.999051941 +0400
@@ -70,26 +70,14 @@
   view->canvas = 0;
 
   view->title_font = default_font;
-  view->message_font = default_font;
   view->terminal_font_name = grub_strdup ("Fixed 10");
   view->title_color = default_fg_color;
-  view->message_color = default_bg_color;
-  view->message_bg_color = default_fg_color;
   view->desktop_image = 0;
   view->desktop_color = default_bg_color;
   view->terminal_box = grub_gfxmenu_create_box (0, 0);
   view->title_text = grub_strdup (_("GRUB Boot Menu"));
-  view->progress_message_text = 0;
   view->theme_path = 0;
 
-  /* Set the timeout bar's frame.  */
-  view->progress_message_frame.width = view->screen.width * 4 / 5;
-  view->progress_message_frame.height = 50;
-  view->progress_message_frame.x = view->screen.x
-    + (view->screen.width - view->progress_message_frame.width) / 2;
-  view->progress_message_frame.y = view->screen.y
-    + view->screen.height - 90 - 20 - view->progress_message_frame.height;
-
   if (grub_gfxmenu_view_load_theme (view, theme_path) != 0)
     {
       grub_gfxmenu_view_destroy (view);
@@ -110,7 +98,6 @@
     view->terminal_box->destroy (view->terminal_box);
   grub_free (view->terminal_font_name);
   grub_free (view->title_text);
-  grub_free (view->progress_message_text);
   grub_free (view->theme_path);
   if (view->canvas)
     view->canvas->component.ops->destroy (view->canvas);
@@ -155,14 +142,6 @@
                          x, y);
 }
 
-struct progress_value_data
-{
-  int visible;
-  int start;
-  int end;
-  int value;
-};
-
 struct grub_gfxmenu_timeout_notify *grub_gfxmenu_timeout_notifications;
 
 static void
@@ -236,32 +215,6 @@
                                 update_menu_visit, view);
 }
 
-static void
-draw_message (grub_gfxmenu_view_t view)
-{
-  char *text = view->progress_message_text;
-  grub_video_rect_t f = view->progress_message_frame;
-  if (! text)
-    return;
-
-  grub_font_t font = view->message_font;
-  grub_video_color_t color = grub_video_map_rgba_color (view->message_color);
-
-  /* Border.  */
-  grub_video_fill_rect (color,
-                        f.x-1, f.y-1, f.width+2, f.height+2);
-  /* Fill.  */
-  grub_video_fill_rect (grub_video_map_rgba_color (view->message_bg_color),
-                        f.x, f.y, f.width, f.height);
-
-  /* Center the text. */
-  int text_width = grub_font_get_string_width (font, text);
-  int x = f.x + (f.width - text_width) / 2;
-  int y = (f.y + (f.height - grub_font_get_descent (font)) / 2
-           + grub_font_get_ascent (font) / 2);
-  grub_font_draw_string (text, font, color, x, y);
-}
-
 void
 grub_gfxmenu_view_redraw (grub_gfxmenu_view_t view,
 			  const grub_video_rect_t *region)
@@ -275,8 +228,6 @@
   if (view->canvas)
     view->canvas->component.ops->paint (view->canvas, region);
   draw_title (view);
-  if (grub_video_have_common_points (&view->progress_message_frame, region))
-    draw_message (view);
 }
 
 void
@@ -410,70 +361,3 @@
 			   border_width);
   grub_gfxterm_decorator_hook = grub_gfxmenu_draw_terminal_box;
 }
-
-/* FIXME: previously notifications were displayed in special case.
-   Is it necessary?
- */
-#if 0
-/* Sets MESSAGE as the progress message for the view.
-   MESSAGE can be 0, in which case no message is displayed.  */
-static void
-set_progress_message (grub_gfxmenu_view_t view, const char *message)
-{
-  grub_free (view->progress_message_text);
-  if (message)
-    view->progress_message_text = grub_strdup (message);
-  else
-    view->progress_message_text = 0;
-}
-
-static void
-notify_booting (grub_menu_entry_t entry, void *userdata)
-{
-  grub_gfxmenu_view_t view = (grub_gfxmenu_view_t) userdata;
-
-  char *s = grub_malloc (100 + grub_strlen (entry->title));
-  if (!s)
-    return;
-
-  grub_sprintf (s, "Booting '%s'", entry->title);
-  set_progress_message (view, s);
-  grub_free (s);
-  grub_gfxmenu_view_redraw (view, &view->progress_message_frame);
-  grub_video_swap_buffers ();
-  if (view->double_repaint)
-    grub_gfxmenu_view_redraw (view, &view->progress_message_frame);
-}
-
-static void
-notify_fallback (grub_menu_entry_t entry, void *userdata)
-{
-  grub_gfxmenu_view_t view = (grub_gfxmenu_view_t) userdata;
-
-  char *s = grub_malloc (100 + grub_strlen (entry->title));
-  if (!s)
-    return;
-
-  grub_sprintf (s, "Falling back to '%s'", entry->title);
-  set_progress_message (view, s);
-  grub_free (s);
-  grub_gfxmenu_view_redraw (view, &view->progress_message_frame);
-  grub_video_swap_buffers ();
-  if (view->double_repaint)
-    grub_gfxmenu_view_redraw (view, &view->progress_message_frame);
-}
-
-static void
-notify_execution_failure (void *userdata __attribute__ ((unused)))
-{
-}
-
-
-static struct grub_menu_execute_callback execute_callback =
-{
-  .notify_booting = notify_booting,
-  .notify_fallback = notify_fallback,
-  .notify_failure = notify_execution_failure
-};
-
-#endif
diff -Naur grub-new3/include/grub/gfxmenu_view.h grub-new4/include/grub/gfxmenu_view.h
--- grub-new3/include/grub/gfxmenu_view.h	2013-04-19 04:01:17.926936694 +0400
+++ grub-new4/include/grub/gfxmenu_view.h	2013-04-24 12:29:40.203816750 +0400
@@ -91,16 +91,12 @@
   grub_video_rect_t screen;
 
   grub_font_t title_font;
-  grub_font_t message_font;
   char *terminal_font_name;
   grub_video_rgba_color_t title_color;
-  grub_video_rgba_color_t message_color;
-  grub_video_rgba_color_t message_bg_color;
   struct grub_video_bitmap *desktop_image;
   grub_video_rgba_color_t desktop_color;
   grub_gfxmenu_box_t terminal_box;
   char *title_text;
-  char *progress_message_text;
   char *theme_path;
 
   grub_gui_container_t canvas;
@@ -109,8 +105,6 @@
 
   int selected;
 
-  grub_video_rect_t progress_message_frame;
-
   grub_menu_t menu;
 
   int nested;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2013-04-26 13:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-26 13:02 [RFC][PATCH] [1/2] remove outdated code Vladimir Testov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.