]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
[two-step] Always finish 2nd step before quitting
authorRay Strode <rstrode@redhat.com>
Mon, 4 May 2009 01:32:08 +0000 (21:32 -0400)
committerRay Strode <rstrode@redhat.com>
Wed, 20 May 2009 21:27:53 +0000 (17:27 -0400)
Previously, we'd cut short in the middle of a very short animation.

src/plugins/splash/two-step/plugin.c

index 68d75ad9140010d58e7c676f24994d4eba1214c6..e66db764c4eead55322b84a0dbc11dfc785de272 100644 (file)
@@ -101,6 +101,7 @@ struct _ply_boot_splash_plugin
   uint32_t background_end_color;
 
   ply_trigger_t *idle_trigger;
+  ply_trigger_t *stop_trigger;
 
   uint32_t root_is_mounted : 1;
   uint32_t is_visible : 1;
@@ -565,6 +566,15 @@ update_status (ply_boot_splash_plugin_t *plugin,
   assert (plugin != NULL);
 }
 
+static void
+on_animation_stopped (ply_boot_splash_plugin_t *plugin)
+{
+  if (plugin->idle_trigger != NULL)
+    {
+      ply_trigger_pull (plugin->idle_trigger, NULL);
+      plugin->idle_trigger = NULL;
+    }
+}
 
 void
 on_boot_progress (ply_boot_splash_plugin_t *plugin,
@@ -577,8 +587,13 @@ on_boot_progress (ply_boot_splash_plugin_t *plugin,
     {
       if (ply_animation_is_stopped (plugin->animation))
         {
+          plugin->stop_trigger = ply_trigger_new (&plugin->stop_trigger);
+          ply_trigger_add_handler (plugin->stop_trigger,
+                                   (ply_trigger_handler_t)
+                                   on_animation_stopped,
+                                   plugin);
           ply_progress_animation_hide (plugin->progress_animation);
-          begin_animation (plugin, NULL);
+          begin_animation (plugin, plugin->stop_trigger);
         }
     }
   else
@@ -698,8 +713,18 @@ void
 become_idle (ply_boot_splash_plugin_t *plugin,
              ply_trigger_t            *idle_trigger)
 {
-  stop_animation (plugin);
-  ply_trigger_pull (idle_trigger, NULL);
+  plugin->idle_trigger = idle_trigger;
+
+  if (ply_animation_is_stopped (plugin->animation))
+    {
+      plugin->stop_trigger = ply_trigger_new (&plugin->stop_trigger);
+      ply_trigger_add_handler (plugin->stop_trigger,
+                               (ply_trigger_handler_t)
+                               on_animation_stopped,
+                               plugin);
+      ply_progress_animation_hide (plugin->progress_animation);
+      begin_animation (plugin, plugin->stop_trigger);
+    }
 }
 
 void display_normal (ply_boot_splash_plugin_t *plugin)