Esempio n. 1
0
static void
destroy_plugin (ply_boot_splash_plugin_t *plugin)
{
  if (plugin == NULL)
    return;

  if (plugin->loop != NULL)
    {
      stop_animation (plugin);

      ply_event_loop_stop_watching_for_exit (plugin->loop, (ply_event_loop_exit_handler_t)
                                             detach_from_event_loop,
                                             plugin);
      detach_from_event_loop (plugin);
    }

  ply_image_free (plugin->box_image);
  ply_image_free (plugin->lock_image);

  if (plugin->corner_image != NULL)
    ply_image_free (plugin->corner_image);

  free_views (plugin);
  free (plugin);
}
Esempio n. 2
0
void
ply_entry_free (ply_entry_t *entry)
{
  if (entry == NULL)
    return;
  ply_image_free (entry->text_field_image);
  ply_image_free (entry->bullet_image);
  ply_label_free (entry->label);
  free (entry->text);

  free (entry);
}
static void
ply_progress_animation_remove_frames (ply_progress_animation_t *progress_animation)
{
  int i;
  ply_image_t **frames;

  frames = (ply_image_t **) ply_array_steal_elements (progress_animation->frames);
  for (i = 0; frames[i] != NULL; i++)
    ply_image_free (frames[i]);
  free (frames);
}
Esempio n. 4
0
static void
ply_throbber_remove_frames (ply_throbber_t *throbber)
{
  int i;
  ply_image_t **frames;

  frames = (ply_image_t **) ply_array_steal_elements (throbber->frames);
  for (i = 0; frames[i] != NULL; i++)
    ply_image_free (frames[i]);
  free (frames);
}
Esempio n. 5
0
static bool
show_splash_screen (ply_boot_splash_plugin_t *plugin,
                    ply_event_loop_t         *loop,
                    ply_buffer_t             *boot_buffer,
                    ply_boot_splash_mode_t    mode)
{
  assert (plugin != NULL);

  plugin->loop = loop;
  plugin->mode = mode;

  ply_trace ("loading lock image");
  if (!ply_image_load (plugin->lock_image))
    return false;

  ply_trace ("loading box image");
  if (!ply_image_load (plugin->box_image))
    return false;

  if (plugin->corner_image != NULL)
    {
      ply_trace ("loading corner image");

      if (!ply_image_load (plugin->corner_image))
        {
          ply_image_free (plugin->corner_image);
          plugin->corner_image = NULL;
        }
    }

  if (!load_views (plugin))
    {
      ply_trace ("couldn't load views");
      return false;
    }

  ply_event_loop_watch_for_exit (loop, (ply_event_loop_exit_handler_t)
                                 detach_from_event_loop,
                                 plugin);

  ply_event_loop_watch_signal (plugin->loop,
                               SIGINT,
                               (ply_event_handler_t)
                               on_interrupt, plugin);

  ply_trace ("starting boot animation");
  start_progress_animation (plugin);

  plugin->is_visible = true;

  return true;
}
Esempio n. 6
0
ply_pixel_buffer_t *
ply_image_convert_to_pixel_buffer (ply_image_t *image)
{
  ply_pixel_buffer_t *buffer;

  assert (image != NULL);

  buffer = image->buffer;
  image->buffer = NULL;
  ply_image_free (image);
  
  return buffer;
}
Esempio n. 7
0
static bool
ply_progress_animation_add_frame (ply_progress_animation_t *progress_animation,
                                  const char               *filename)
{
        ply_image_t *image;

        image = ply_image_new (filename);

        if (!ply_image_load (image)) {
                ply_image_free (image);
                return false;
        }

        ply_array_add_pointer_element (progress_animation->frames, image);

        progress_animation->area.width = MAX (progress_animation->area.width, (size_t) ply_image_get_width (image));
        progress_animation->area.height = MAX (progress_animation->area.height, (size_t) ply_image_get_height (image));

        return true;
}
Esempio n. 8
0
static bool
ply_throbber_add_frame (ply_throbber_t *throbber,
                    const char *filename)
{
  ply_image_t *image;

  image = ply_image_new (filename);

  if (!ply_image_load (image))
    {
      ply_image_free (image);
      return false;
    }

  ply_array_add_element (throbber->frames, image);

  throbber->width = MAX (throbber->width, ply_image_get_width (image));
  throbber->height = MAX (throbber->height, ply_image_get_height (image));

  return true;
}
Esempio n. 9
0
static bool
ply_animation_add_frame (ply_animation_t *animation,
                         const char      *filename)
{
  ply_image_t *image;

  image = ply_image_new (filename);

  if (!ply_image_load (image))
    {
      ply_image_free (image);
      return false;
    }

  ply_array_add_element (animation->frames, image);

  animation->width = MAX (animation->width, ply_image_get_width (image));
  animation->height = MAX (animation->height, ply_image_get_height (image));

  return true;
}
Esempio n. 10
0
static bool
ply_throbber_add_frame (ply_throbber_t *throbber,
                        const char     *filename)
{
        ply_image_t *image;
        ply_pixel_buffer_t *frame;

        image = ply_image_new (filename);

        if (!ply_image_load (image)) {
                ply_image_free (image);
                return false;
        }

        frame = ply_image_convert_to_pixel_buffer (image);

        ply_array_add_pointer_element (throbber->frames, frame);

        throbber->width = MAX (throbber->width, (long) ply_pixel_buffer_get_width (frame));
        throbber->height = MAX (throbber->height, (long) ply_pixel_buffer_get_height (frame));

        return true;
}