]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
main: split start_boot_splash up into two functions
authorRay Strode <rstrode@redhat.com>
Thu, 5 Dec 2013 19:39:50 +0000 (14:39 -0500)
committerRay Strode <rstrode@redhat.com>
Fri, 6 Dec 2013 21:23:45 +0000 (16:23 -0500)
Right now start_boot_splash loads the theme, then
shows it.

It's going to be useful in the future to preload the
theme, so this commit breaks the two operations out
into two functions, load_theme and show_theme,
and makes start_boot_splash just call those two
functions.

src/main.c

index fb0b90e096b0c7ff6f950e036afdb149239a1090..b6fd805e544c8b1d623830f5e5658f179866f53d 100644 (file)
@@ -125,6 +125,11 @@ typedef struct
   int number_of_errors;
 } state_t;
 
+static ply_boot_splash_t *load_theme (state_t    *state,
+                                      const char *theme_path,
+                                      bool        fall_back_if_neccessary);
+static void show_theme (state_t           *state,
+                        ply_boot_splash_t *splash);
 static ply_boot_splash_t *start_boot_splash (state_t    *state,
                                              const char *theme_path,
                                              bool        fall_back_if_neccessary);
@@ -1664,12 +1669,11 @@ tell_systemd_to_stop_printing_details (state_t *state)
 #endif
 
 static ply_boot_splash_t *
-start_boot_splash (state_t    *state,
-                   const char *theme_path,
-                   bool        fall_back_if_neccessary)
+load_theme (state_t    *state,
+            const char *theme_path,
+            bool        fall_back_if_neccessary)
 {
   ply_boot_splash_t *splash;
-  ply_boot_splash_mode_t splash_mode;
   bool is_loaded;
 
   ply_trace ("Loading boot splash theme '%s'",
@@ -1702,7 +1706,14 @@ start_boot_splash (state_t    *state,
   ply_trace ("attaching progress to plugin");
   ply_boot_splash_attach_progress (splash, state->progress);
 
-  add_displays_and_keyboard_to_boot_splash (state, splash);
+  return splash;
+}
+
+static void
+show_theme (state_t           *state,
+            ply_boot_splash_t *splash)
+{
+  ply_boot_splash_mode_t splash_mode;
 
   ply_trace ("showing plugin");
   if (state->mode == PLY_MODE_SHUTDOWN)
@@ -1716,7 +1727,7 @@ start_boot_splash (state_t    *state,
       ply_boot_splash_unset_keyboard (splash);
       ply_boot_splash_free (splash);
       ply_restore_errno ();
-      return NULL;
+      return;
     }
 
 #ifdef PLY_ENABLE_SYSTEMD_INTEGRATION
@@ -1728,6 +1739,19 @@ start_boot_splash (state_t    *state,
     ply_keyboard_watch_for_input (state->keyboard);
 
   update_display (state);
+}
+
+static ply_boot_splash_t *
+start_boot_splash (state_t    *state,
+                   const char *theme_path,
+                   bool        fall_back_if_necessary)
+{
+  ply_boot_splash_t *splash;
+
+  splash = load_theme (state, theme_path, fall_back_if_necessary);
+  add_displays_and_keyboard_to_boot_splash (state, splash);
+  show_theme (state, splash);
+
   return splash;
 }