[PATCH 09/20] [main] add deactivate_splash() function

Scott James Remnant scott at ubuntu.com
Thu Mar 18 13:38:13 PDT 2010


To make it easier to alter the deactivate path, split into its own
function.
---
 src/main.c |   34 ++++++++++++++++++++++------------
 1 files changed, 22 insertions(+), 12 deletions(-)

diff --git a/src/main.c b/src/main.c
index cb56506..c320842 100644
--- a/src/main.c
+++ b/src/main.c
@@ -33,6 +33,7 @@
 #include <unistd.h>
 #include <wchar.h>
 #include <paths.h>
+#include <assert.h>
 
 #include <linux/kd.h>
 #include <linux/vt.h>
@@ -721,6 +722,25 @@ quit_program (state_t *state)
 }
 
 static void
+deactivate_splash (state_t *state)
+{
+  assert (!state->is_inactive);
+
+  if (state->renderer != NULL)
+    {
+      ply_trace ("deactivating renderer");
+      ply_renderer_deactivate (state->renderer);
+    }
+
+  ply_trace ("quitting splash");
+  quit_splash (state);
+
+  ply_trigger_pull (state->deactivate_trigger, NULL);
+  state->deactivate_trigger = NULL;
+  state->is_inactive = true;
+}
+
+static void
 on_boot_splash_idle (state_t *state)
 {
   ply_trace ("boot splash idle");
@@ -744,18 +764,8 @@ on_boot_splash_idle (state_t *state)
     }
   else if (state->deactivate_trigger != NULL)
     {
-      if (state->renderer != NULL)
-        {
-          ply_trace ("deactivating renderer");
-          ply_renderer_deactivate (state->renderer);
-        }
-
-      ply_trace ("quitting splash");
-      quit_splash (state);
-
-      ply_trigger_pull (state->deactivate_trigger, NULL);
-      state->deactivate_trigger = NULL;
-      state->is_inactive = true;
+      ply_trace ("deactivating splash");
+      deactivate_splash (state);
     }
 }
 
-- 
1.7.0



More information about the plymouth mailing list