diff --git a/src/libplybootsplash/ply-boot-splash-plugin.h b/src/libplybootsplash/ply-boot-splash-plugin.h index 8e3d2fac..c5f35547 100644 --- a/src/libplybootsplash/ply-boot-splash-plugin.h +++ b/src/libplybootsplash/ply-boot-splash-plugin.h @@ -27,9 +27,10 @@ #include #include "ply-answer.h" -#include "ply-event-loop.h" -#include "ply-window.h" #include "ply-buffer.h" +#include "ply-event-loop.h" +#include "ply-trigger.h" +#include "ply-window.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 */ diff --git a/src/ply-boot-splash.c b/src/ply-boot-splash.c index a9baa3ee..7f606448 100644 --- a/src/ply-boot-splash.c +++ b/src/ply-boot-splash.c @@ -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 diff --git a/src/ply-boot-splash.h b/src/ply-boot-splash.h index aeddc249..5efa6785 100644 --- a/src/ply-boot-splash.h +++ b/src/ply-boot-splash.h @@ -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