]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
Add new interface to make splash plugin go to idle
authorRay Strode <rstrode@redhat.com>
Mon, 22 Sep 2008 03:12:12 +0000 (23:12 -0400)
committerRay Strode <rstrode@redhat.com>
Tue, 23 Sep 2008 18:29:39 +0000 (14:29 -0400)
There are times when we want to make the splash
screen stop any pending animations and got to an
idle state.  For instance, right before resuming,
or right before loading up GDM.  It may take a
few frames for the splash screen to get there though.
This interface tells the splash screen it needs to
idle and provides a trigger for it to fire when it's
actually made it to an idle state.

src/libplybootsplash/ply-boot-splash-plugin.h
src/ply-boot-splash.c
src/ply-boot-splash.h

index 8e3d2facd88762c332011acb04d348ccdc9bee9d..c5f3554786edaa53e8b563b30cfd1d43b9a9ae56 100644 (file)
 #include <unistd.h>
 
 #include "ply-answer.h"
+#include "ply-buffer.h"
 #include "ply-event-loop.h"
+#include "ply-trigger.h"
 #include "ply-window.h"
-#include "ply-buffer.h"
 
 typedef struct _ply_boot_splash_plugin ply_boot_splash_plugin_t;
 
@@ -60,6 +61,8 @@ typedef struct
   void (* ask_for_password) (ply_boot_splash_plugin_t *plugin,
                              const char               *prompt,
                              ply_answer_t             *answer);
+  void (* become_idle) (ply_boot_splash_plugin_t       *plugin,
+                        ply_trigger_t                  *idle_trigger);
 } ply_boot_splash_plugin_interface_t;
 
 #endif /* PLY_BOOT_SPLASH_PLUGIN_H */
index a9baa3eed6294553b0f3481e912a894b723d4270..7f606448d331a4c4869bc60b4e09c735e2e4819c 100644 (file)
@@ -36,6 +36,7 @@
 #include "ply-event-loop.h"
 #include "ply-list.h"
 #include "ply-logger.h"
+#include "ply-trigger.h"
 #include "ply-utils.h"
 
 struct _ply_boot_splash
@@ -46,6 +47,7 @@ struct _ply_boot_splash
   ply_boot_splash_plugin_t *plugin;
   ply_window_t *window;
   ply_buffer_t *boot_buffer;
+  ply_trigger_t *idle_trigger;
 
   char *module_name;
   char *status;
@@ -290,6 +292,24 @@ ply_boot_splash_attach_to_event_loop (ply_boot_splash_t *splash,
                                  splash); 
 }
 
+void
+ply_boot_splash_become_idle (ply_boot_splash_t                  *splash,
+                             ply_boot_splash_on_idle_handler_t  idle_handler,
+                             void                              *user_data)
+{
+  assert (splash->idle_trigger == NULL);
+
+  if (splash->plugin_interface->become_idle == NULL)
+    {
+      idle_handler (user_data);
+      return;
+    }
+
+  splash->idle_trigger = ply_trigger_new ((ply_trigger_handler_t) idle_handler, user_data, &splash->idle_trigger);
+
+  splash->plugin_interface->become_idle (splash->plugin, splash->idle_trigger);
+}
+
 #ifdef PLY_BOOT_SPLASH_ENABLE_TEST
 
 #include <stdio.h>
index aeddc249320c00c4ed124a96beae65ace5f54135..5efa6785de31ec64b36210e439f264226fd763bc 100644 (file)
@@ -34,6 +34,8 @@
 
 typedef struct _ply_boot_splash ply_boot_splash_t;
 
+typedef void (* ply_boot_splash_on_idle_handler_t) (void *user_data);
+
 #ifndef PLY_HIDE_FUNCTION_DECLARATIONS
 ply_boot_splash_t *ply_boot_splash_new (const char *module_name,
                                         ply_window_t *window,
@@ -53,6 +55,10 @@ void ply_boot_splash_ask_for_password (ply_boot_splash_t *splash,
 void ply_boot_splash_hide (ply_boot_splash_t *splash);
 void ply_boot_splash_attach_to_event_loop (ply_boot_splash_t *splash,
                                            ply_event_loop_t  *loop);
+void ply_boot_splash_become_idle (ply_boot_splash_t               *splash,
+                                  ply_boot_splash_on_idle_handler_t  idle_handler,
+                                  void                            *user_data);
+
 
 #endif