Ejemplo n.º 1
0
void script_lib_plymouth_on_display_question (script_state_t             *state,
                                              script_lib_plymouth_data_t *data,
                                              const char                 *prompt,
                                              const char                 *entry_text)
{
        script_obj_t *prompt_obj = script_obj_new_string (prompt);
        script_obj_t *entry_text_obj = script_obj_new_string (entry_text);
        script_return_t ret = script_execute_object (state,
                                                     data->script_display_question_func,
                                                     NULL,
                                                     prompt_obj,
                                                     entry_text_obj,
                                                     NULL);

        script_obj_unref (prompt_obj);
        script_obj_unref (entry_text_obj);
        script_obj_unref (ret.object);
}
Ejemplo n.º 2
0
static script_return_t plymouth_get_mode (script_state_t *state,
                                          void           *user_data)
{
        script_lib_plymouth_data_t *data = user_data;
        script_obj_t *obj;

        switch (data->mode) {
        case PLY_BOOT_SPLASH_MODE_BOOT_UP:
                obj = script_obj_new_string ("boot");
                break;
        case PLY_BOOT_SPLASH_MODE_SHUTDOWN:
                obj = script_obj_new_string ("shutdown");
                break;
        case PLY_BOOT_SPLASH_MODE_UPDATES:
                obj = script_obj_new_string ("updates");
                break;
        case PLY_BOOT_SPLASH_MODE_INVALID:
        default:
                obj = script_obj_new_string ("unknown");
                break;
        }
        return script_return_obj (obj);
}
Ejemplo n.º 3
0
void script_lib_plymouth_on_hide_message (script_state_t             *state,
                                          script_lib_plymouth_data_t *data,
                                          const char                 *message)
{
        script_obj_t *new_message_obj = script_obj_new_string (message);
        script_return_t ret = script_execute_object (state,
                                                     data->script_hide_message_func,
                                                     NULL,
                                                     new_message_obj,
                                                     NULL);

        script_obj_unref (new_message_obj);
        script_obj_unref (ret.object);
}
Ejemplo n.º 4
0
void script_lib_plymouth_on_update_status (script_state_t             *state,
                                           script_lib_plymouth_data_t *data,
                                           const char                 *new_status)
{
        script_obj_t *new_status_obj = script_obj_new_string (new_status);
        script_return_t ret = script_execute_object (state,
                                                     data->script_update_status_func,
                                                     NULL,
                                                     new_status_obj,
                                                     NULL);

        script_obj_unref (new_status_obj);
        script_obj_unref (ret.object);
}
Ejemplo n.º 5
0
void script_lib_plymouth_on_keyboard_input (script_state_t             *state,
                                            script_lib_plymouth_data_t *data,
                                            const char                 *keyboard_input)
{
        script_obj_t *keyboard_input_obj = script_obj_new_string (keyboard_input);
        script_return_t ret = script_execute_object (state,
                                                     data->script_keyboard_input_func,
                                                     NULL,
                                                     keyboard_input_obj,
                                                     NULL);

        script_obj_unref (keyboard_input_obj);
        script_obj_unref (ret.object);
}
Ejemplo n.º 6
0
void script_lib_plymouth_on_display_password (script_state_t             *state,
                                              script_lib_plymouth_data_t *data,
                                              const char                 *prompt,
                                              int                         bullets)
{
        script_obj_t *prompt_obj = script_obj_new_string (prompt);
        script_obj_t *bullets_obj = script_obj_new_number (bullets);
        script_return_t ret = script_execute_object (state,
                                                     data->script_display_password_func,
                                                     NULL,
                                                     prompt_obj,
                                                     bullets_obj,
                                                     NULL);

        script_obj_unref (prompt_obj);
        script_obj_unref (bullets_obj);
        script_obj_unref (ret.object);
}
Ejemplo n.º 7
0
static bool
start_script_animation (ply_boot_splash_plugin_t *plugin)
{
  ply_list_node_t *node;
  script_obj_t *target_obj;
  script_obj_t *value_obj;
  script_env_var_t *env_var;
  
  assert (plugin != NULL);

  plugin->script_state = script_state_new (plugin);
  
  for (node = ply_list_get_first_node (plugin->script_env_vars);
       node != NULL;
       node = ply_list_get_next_node (plugin->script_env_vars, node))
    {
      env_var = ply_list_node_get_data (node);
      target_obj = script_obj_hash_get_element (plugin->script_state->global,
                                                env_var->key);
      value_obj = script_obj_new_string (env_var->value);
      script_obj_assign (target_obj, value_obj);
    }
  
  plugin->script_image_lib = script_lib_image_setup (plugin->script_state,
                                                     plugin->image_dir);
  plugin->script_sprite_lib = script_lib_sprite_setup (plugin->script_state,
                                                       plugin->displays);
  plugin->script_plymouth_lib = script_lib_plymouth_setup (plugin->script_state,
                                                           plugin->mode);
  plugin->script_math_lib = script_lib_math_setup (plugin->script_state);
  plugin->script_string_lib = script_lib_string_setup (plugin->script_state);

  ply_trace ("executing script file");
  script_return_t ret = script_execute (plugin->script_state,
                                        plugin->script_main_op);
  script_obj_unref (ret.object);
  if (plugin->keyboard != NULL)
    ply_keyboard_add_input_handler (plugin->keyboard,
                                    (ply_keyboard_input_handler_t)
                                    on_keyboard_input, plugin);
  on_timeout (plugin);

  return true;
}