diff options
| author | Ray Strode <rstrode@redhat.com> | 2008-06-02 11:49:00 -0400 |
|---|---|---|
| committer | Ray Strode <rstrode@redhat.com> | 2008-06-02 11:49:00 -0400 |
| commit | f5a15611fb5fe1d36f8922e1c2a6f751ab0b8df7 (patch) | |
| tree | f44de427f359bdc19b76bf440cde0c4181d27d9e /src/splash-plugins | |
| parent | ccd95672582f2cfc98d0d6985603bda84f48f170 (diff) | |
| download | plymouth-f5a15611fb5fe1d36f8922e1c2a6f751ab0b8df7.tar.gz plymouth-f5a15611fb5fe1d36f8922e1c2a6f751ab0b8df7.tar.xz plymouth-f5a15611fb5fe1d36f8922e1c2a6f751ab0b8df7.zip | |
Port password handling over to using new answer object
Diffstat (limited to 'src/splash-plugins')
| -rw-r--r-- | src/splash-plugins/details/Makefile.am | 2 | ||||
| -rw-r--r-- | src/splash-plugins/details/plugin.c | 17 | ||||
| -rw-r--r-- | src/splash-plugins/fade-in/Makefile.am | 2 | ||||
| -rw-r--r-- | src/splash-plugins/fade-in/plugin.c | 21 | ||||
| -rw-r--r-- | src/splash-plugins/spinfinity/Makefile.am | 2 | ||||
| -rw-r--r-- | src/splash-plugins/spinfinity/plugin.c | 18 | ||||
| -rw-r--r-- | src/splash-plugins/text/Makefile.am | 2 | ||||
| -rw-r--r-- | src/splash-plugins/text/plugin.c | 18 |
8 files changed, 43 insertions, 39 deletions
diff --git a/src/splash-plugins/details/Makefile.am b/src/splash-plugins/details/Makefile.am index 0550db0..b289d52 100644 --- a/src/splash-plugins/details/Makefile.am +++ b/src/splash-plugins/details/Makefile.am @@ -11,6 +11,8 @@ details_la_CFLAGS = $(PLYMOUTH_CFLAGS) details_la_LDFLAGS = -module -avoid-version -export-dynamic details_la_LIBADD = $(PLYMOUTH_LIBS) ../../libply/libply.la details_la_SOURCES = $(srcdir)/../../ply-boot-splash-plugin.h \ + $(srcdir)/../../ply-answer.h \ + $(srcdir)/../../ply-answer.c \ $(srcdir)/../../ply-window.h \ $(srcdir)/../../ply-window.c \ $(srcdir)/plugin.c diff --git a/src/splash-plugins/details/plugin.c b/src/splash-plugins/details/plugin.c index 48d5ac9..9c9f5f4 100644 --- a/src/splash-plugins/details/plugin.c +++ b/src/splash-plugins/details/plugin.c @@ -40,6 +40,7 @@ #include <wchar.h> #include <values.h> +#include "ply-answer.h" #include "ply-boot-splash-plugin.h" #include "ply-buffer.h" #include "ply-event-loop.h" @@ -59,8 +60,7 @@ struct _ply_boot_splash_plugin { ply_event_loop_t *loop; - ply_boot_splash_password_answer_handler_t password_answer_handler; - void *password_answer_data; + ply_answer_t *pending_password_answer; uint32_t keyboard_input_is_hidden : 1; }; @@ -117,12 +117,11 @@ void on_enter (ply_boot_splash_plugin_t *plugin, const char *line) { - if (plugin->password_answer_handler != NULL) + if (plugin->pending_password_answer != NULL) { - plugin->password_answer_handler (plugin->password_answer_data, - line); + ply_answer_with_string (plugin->pending_password_answer, line); plugin->keyboard_input_is_hidden = false; - plugin->password_answer_handler = NULL; + plugin->pending_password_answer = NULL; write (STDOUT_FILENO, CLEAR_LINE_SEQUENCE, strlen (CLEAR_LINE_SEQUENCE)); } } @@ -203,11 +202,9 @@ hide_splash_screen (ply_boot_splash_plugin_t *plugin, void ask_for_password (ply_boot_splash_plugin_t *plugin, - ply_boot_splash_password_answer_handler_t answer_handler, - void *answer_data) + ply_answer_t *answer) { - plugin->password_answer_handler = answer_handler; - plugin->password_answer_data = answer_data; + plugin->pending_password_answer = answer; write (STDOUT_FILENO, "\nPassword: ", strlen ("\nPassword: ")); plugin->keyboard_input_is_hidden = true; diff --git a/src/splash-plugins/fade-in/Makefile.am b/src/splash-plugins/fade-in/Makefile.am index bc37f28..4e26835 100644 --- a/src/splash-plugins/fade-in/Makefile.am +++ b/src/splash-plugins/fade-in/Makefile.am @@ -14,6 +14,8 @@ fade_in_la_CFLAGS = $(PLYMOUTH_CFLAGS) \ fade_in_la_LDFLAGS = -module -avoid-version -export-dynamic fade_in_la_LIBADD = $(PLYMOUTH_LIBS) ../../libply/libply.la fade_in_la_SOURCES = $(srcdir)/../../ply-boot-splash-plugin.h \ + $(srcdir)/../../ply-answer.h \ + $(srcdir)/../../ply-answer.c \ $(srcdir)/../../ply-window.h \ $(srcdir)/../../ply-window.c \ $(srcdir)/plugin.c diff --git a/src/splash-plugins/fade-in/plugin.c b/src/splash-plugins/fade-in/plugin.c index c30e943..13236d3 100644 --- a/src/splash-plugins/fade-in/plugin.c +++ b/src/splash-plugins/fade-in/plugin.c @@ -39,6 +39,7 @@ #include <unistd.h> #include <wchar.h> +#include "ply-answer.h" #include "ply-boot-splash-plugin.h" #include "ply-buffer.h" #include "ply-event-loop.h" @@ -84,8 +85,7 @@ struct _ply_boot_splash_plugin entry_t *entry; - ply_boot_splash_password_answer_handler_t password_answer_handler; - void *password_answer_data; + ply_answer_t *pending_password_answer; double start_time; double now; @@ -376,7 +376,7 @@ on_keyboard_input (ply_boot_splash_plugin_t *plugin, const char *keyboard_input, size_t character_size) { - if (plugin->password_answer_handler == NULL) + if (plugin->pending_password_answer == NULL) return; plugin->entry->number_of_bullets++; @@ -394,8 +394,13 @@ void on_enter (ply_boot_splash_plugin_t *plugin, const char *text) { - plugin->password_answer_handler (plugin->password_answer_data, - text); + + if (plugin->pending_password_answer == NULL) + return; + + ply_answer_with_string (plugin->pending_password_answer, text); + plugin->pending_password_answer = NULL; + plugin->entry->number_of_bullets = 0; entry_free (plugin->entry); plugin->entry = NULL; @@ -650,11 +655,9 @@ show_password_entry (ply_boot_splash_plugin_t *plugin) void ask_for_password (ply_boot_splash_plugin_t *plugin, - ply_boot_splash_password_answer_handler_t answer_handler, - void *answer_data) + ply_answer_t *answer) { - plugin->password_answer_handler = answer_handler; - plugin->password_answer_data = answer_data; + plugin->pending_password_answer = answer; stop_animation (plugin); show_password_entry (plugin); diff --git a/src/splash-plugins/spinfinity/Makefile.am b/src/splash-plugins/spinfinity/Makefile.am index fa6784d..23cdd54 100644 --- a/src/splash-plugins/spinfinity/Makefile.am +++ b/src/splash-plugins/spinfinity/Makefile.am @@ -15,6 +15,8 @@ spinfinity_la_CFLAGS = $(PLYMOUTH_CFLAGS) \ spinfinity_la_LDFLAGS = -module -avoid-version -export-dynamic spinfinity_la_LIBADD = $(PLYMOUTH_LIBS) ../../libply/libply.la spinfinity_la_SOURCES = $(srcdir)/../../ply-boot-splash-plugin.h \ + $(srcdir)/../../ply-answer.h \ + $(srcdir)/../../ply-answer.c \ $(srcdir)/../../ply-window.h \ $(srcdir)/../../ply-window.c \ $(srcdir)/throbber.h \ diff --git a/src/splash-plugins/spinfinity/plugin.c b/src/splash-plugins/spinfinity/plugin.c index 24298e7..b8f9b53 100644 --- a/src/splash-plugins/spinfinity/plugin.c +++ b/src/splash-plugins/spinfinity/plugin.c @@ -39,6 +39,7 @@ #include <unistd.h> #include <wchar.h> +#include "ply-answer.h" #include "ply-boot-splash-plugin.h" #include "ply-buffer.h" #include "ply-event-loop.h" @@ -78,8 +79,7 @@ struct _ply_boot_splash_plugin entry_t *entry; throbber_t *throbber; - ply_boot_splash_password_answer_handler_t password_answer_handler; - void *password_answer_data; + ply_answer_t *pending_password_answer; }; static void detach_from_event_loop (ply_boot_splash_plugin_t *plugin); @@ -245,7 +245,7 @@ on_keyboard_input (ply_boot_splash_plugin_t *plugin, const char *keyboard_input, size_t character_size) { - if (plugin->password_answer_handler == NULL) + if (plugin->pending_password_answer == NULL) return; plugin->entry->number_of_bullets++; @@ -263,11 +263,11 @@ void on_enter (ply_boot_splash_plugin_t *plugin, const char *text) { - if (plugin->password_answer_handler == NULL) + if (plugin->pending_password_answer == NULL) return; - plugin->password_answer_handler (plugin->password_answer_data, - text); + ply_answer_with_string (plugin->pending_password_answer, text); + plugin->pending_password_answer = NULL; if (plugin->entry != NULL) { @@ -456,11 +456,9 @@ show_password_entry (ply_boot_splash_plugin_t *plugin) void ask_for_password (ply_boot_splash_plugin_t *plugin, - ply_boot_splash_password_answer_handler_t answer_handler, - void *answer_data) + ply_answer_t *answer) { - plugin->password_answer_handler = answer_handler; - plugin->password_answer_data = answer_data; + plugin->pending_password_answer = answer; stop_animation (plugin); show_password_entry (plugin); diff --git a/src/splash-plugins/text/Makefile.am b/src/splash-plugins/text/Makefile.am index 27b2cf7..2d9ba73 100644 --- a/src/splash-plugins/text/Makefile.am +++ b/src/splash-plugins/text/Makefile.am @@ -11,6 +11,8 @@ text_la_CFLAGS = $(PLYMOUTH_CFLAGS) text_la_LDFLAGS = -module -avoid-version -export-dynamic text_la_LIBADD = $(PLYMOUTH_LIBS) ../../libply/libply.la text_la_SOURCES = $(srcdir)/../../ply-boot-splash-plugin.h \ + $(srcdir)/../../ply-answer.h \ + $(srcdir)/../../ply-answer.c \ $(srcdir)/../../ply-window.h \ $(srcdir)/../../ply-window.c \ $(srcdir)/plugin.c diff --git a/src/splash-plugins/text/plugin.c b/src/splash-plugins/text/plugin.c index a342fa7..3ad9234 100644 --- a/src/splash-plugins/text/plugin.c +++ b/src/splash-plugins/text/plugin.c @@ -40,6 +40,7 @@ #include <values.h> #include <wchar.h> +#include "ply-answer.h" #include "ply-boot-splash-plugin.h" #include "ply-buffer.h" #include "ply-event-loop.h" @@ -60,8 +61,8 @@ struct _ply_boot_splash_plugin ply_event_loop_t *loop; int console_fd; - ply_boot_splash_password_answer_handler_t password_answer_handler; - void *password_answer_data; + + ply_answer_t *pending_password_answer; uint32_t keyboard_input_is_hidden : 1; }; @@ -132,12 +133,11 @@ void on_enter (ply_boot_splash_plugin_t *plugin, const char *line) { - if (plugin->password_answer_handler != NULL) + if (plugin->pending_password_answer != NULL) { - plugin->password_answer_handler (plugin->password_answer_data, - line); + ply_answer_with_string (plugin->pending_password_answer, line); plugin->keyboard_input_is_hidden = false; - plugin->password_answer_handler = NULL; + plugin->pending_password_answer = NULL; write (STDOUT_FILENO, CLEAR_LINE_SEQUENCE, strlen (CLEAR_LINE_SEQUENCE)); } } @@ -207,11 +207,9 @@ hide_splash_screen (ply_boot_splash_plugin_t *plugin, void ask_for_password (ply_boot_splash_plugin_t *plugin, - ply_boot_splash_password_answer_handler_t answer_handler, - void *answer_data) + ply_answer_t *answer) { - plugin->password_answer_handler = answer_handler; - plugin->password_answer_data = answer_data; + plugin->pending_password_answer = answer; write (STDOUT_FILENO, "\nPassword: ", strlen ("\nPassword: ")); plugin->keyboard_input_is_hidden = true; |
