]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
boot-client: Add hide-message client command
authorCharlie Brej <cbrej@cs.man.ac.uk>
Tue, 7 Sep 2010 20:23:14 +0000 (21:23 +0100)
committerCharlie Brej <cbrej@cs.man.ac.uk>
Tue, 7 Sep 2010 20:23:14 +0000 (21:23 +0100)
This renames "message" command to "display-message".

src/client/ply-boot-client.c
src/client/ply-boot-client.h
src/client/plymouth.c

index 48932ac4d7416c1d29520a25dd49bc0c0ca5c354..48f32583956817b09f7f0b1fda015bd0b1db3894 100644 (file)
@@ -555,6 +555,20 @@ ply_boot_client_tell_daemon_to_display_message (ply_boot_client_t
                                  message, handler, failed_handler, user_data);
 }
 
+void
+ply_boot_client_tell_daemon_to_hide_message (ply_boot_client_t                  *client,
+                                             const char                         *message,
+                                             ply_boot_client_response_handler_t  handler,
+                                             ply_boot_client_response_handler_t  failed_handler,
+                                             void                               *user_data)
+{
+  assert (client != NULL);
+  assert (message != NULL);
+
+  ply_boot_client_queue_request (client, PLY_BOOT_PROTOCOL_REQUEST_TYPE_HIDE_MESSAGE,
+                                 message, handler, failed_handler, user_data);
+}
+
 void
 ply_boot_client_tell_daemon_system_is_initialized (ply_boot_client_t                  *client,
                                                    ply_boot_client_response_handler_t  handler,
index 1608876124e0f605df831f1517df9debba781b31..78fdd214c3c7d7c2401fca58ef321b9a28c9aa51 100644 (file)
@@ -68,6 +68,11 @@ void ply_boot_client_tell_daemon_to_display_message (ply_boot_client_t
                                                      ply_boot_client_response_handler_t  handler,
                                                      ply_boot_client_response_handler_t  failed_handler,
                                                      void                               *user_data);
+void ply_boot_client_tell_daemon_to_hide_message (ply_boot_client_t                  *client,
+                                                  const char                         *message,
+                                                  ply_boot_client_response_handler_t  handler,
+                                                  ply_boot_client_response_handler_t  failed_handler,
+                                                  void                               *user_data);
 void ply_boot_client_ask_daemon_for_password (ply_boot_client_t                  *client,
                                               const char                         *prompt,
                                               ply_boot_client_answer_handler_t    handler,
index 552c36a65882f25de6988b6e5f9a4dee23fda835..ffde13267c033c7e10c86acff4eb6854b9097985 100644 (file)
@@ -585,8 +585,8 @@ on_question_request (state_t    *state,
 }
 
 static void
-on_message_request (state_t    *state,
-                    const char *command)
+on_display_message_request (state_t    *state,
+                            const char *command)
 {
   char *text;
 
@@ -607,6 +607,29 @@ on_message_request (state_t    *state,
     }
 }
 
+static void
+on_hide_message_request (state_t    *state,
+                         const char *command)
+{
+  char *text;
+
+  text = NULL;
+  ply_command_parser_get_command_options (state->command_parser,
+                                          command,
+                                          "text", &text,
+                                          NULL);
+  if (text != NULL)
+    {
+      ply_boot_client_tell_daemon_to_hide_message (state->client,
+                                                   text,
+                                                   (ply_boot_client_response_handler_t)
+                                                   on_success,
+                                                   (ply_boot_client_response_handler_t)
+                                                   on_failure, state);
+      free (text);
+    }
+}
+
 static void
 on_keystroke_request (state_t    *state,
                      const char *command)
@@ -936,9 +959,17 @@ main (int    argc,
                                   NULL);
 
   ply_command_parser_add_command (state.command_parser,
-                                  "message", "Display a message",
+                                  "display-message", "Display a message",
+                                  (ply_command_handler_t)
+                                  on_display_message_request, &state,
+                                  "text", "The message text",
+                                  PLY_COMMAND_OPTION_TYPE_STRING,
+                                  NULL);
+
+  ply_command_parser_add_command (state.command_parser,
+                                  "hide-message", "Hide a message",
                                   (ply_command_handler_t)
-                                  on_message_request, &state,
+                                  on_hide_message_request, &state,
                                   "text", "The message text",
                                   PLY_COMMAND_OPTION_TYPE_STRING,
                                   NULL);