Beispiel #1
0
GimpUndo *
gimp_undo_stack_free_bottom (GimpUndoStack *stack,
                             GimpUndoMode   undo_mode)
{
  GimpUndo *undo;
  gint      n_children;

  g_return_val_if_fail (GIMP_IS_UNDO_STACK (stack), NULL);

  n_children = gimp_container_num_children (GIMP_CONTAINER (stack->undos));

  undo = (GimpUndo *)
    gimp_container_get_child_by_index (GIMP_CONTAINER (stack->undos),
                                       n_children - 1);

  if (undo)
    {
      gimp_container_remove (GIMP_CONTAINER (stack->undos), GIMP_OBJECT (undo));
      gimp_undo_free (undo, undo_mode);

      return undo;
    }

  return NULL;
}
Beispiel #2
0
static void
gimp_undo_stack_free (GimpUndo     *undo,
                      GimpUndoMode  undo_mode)
{
  GimpUndoStack *stack = GIMP_UNDO_STACK (undo);
  GList         *list;

  for (list = GIMP_LIST (stack->undos)->queue->head;
       list;
       list = g_list_next (list))
    {
      GimpUndo *child = list->data;

      gimp_undo_free (child, undo_mode);
      g_object_unref (child);
    }

  gimp_container_clear (stack->undos);
}
Beispiel #3
0
GimpUndo *
gimp_undo_stack_free_bottom (GimpUndoStack *stack,
                             GimpUndoMode   undo_mode)
{
  GimpUndo *undo;

  g_return_val_if_fail (GIMP_IS_UNDO_STACK (stack), NULL);

  undo = GIMP_UNDO (gimp_container_get_last_child (stack->undos));

  if (undo)
    {
      gimp_container_remove (stack->undos, GIMP_OBJECT (undo));
      gimp_undo_free (undo, undo_mode);

      return undo;
    }

  return NULL;
}
Beispiel #4
0
static void
gimp_undo_stack_free (GimpUndo     *undo,
                      GimpUndoMode  undo_mode)
{
  GimpUndoStack *stack = GIMP_UNDO_STACK (undo);
  GList         *list;

  for (list = GIMP_LIST (stack->undos)->list;
       list;
       list = g_list_next (list))
    {
      GimpUndo *child = list->data;

      gimp_undo_free (child, undo_mode);
      g_object_unref (child);
    }

  while (GIMP_LIST (stack->undos)->list)
    gimp_container_remove (GIMP_CONTAINER (stack->undos),
                           GIMP_LIST (stack->undos)->list->data);
}