Esempio n. 1
0
static bool
start_script_animation (ply_boot_splash_plugin_t *plugin)
{
  assert (plugin != NULL);

  plugin->script_state = script_state_new (plugin);
  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;
}
Esempio n. 2
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;
}