Long overdue core container cleanup:
2004-05-24 Michael Natterer <mitch@gimp.org> Long overdue core container cleanup: * app/core/gimplist.[ch]: added "unique-names" and "sort-func" properties and merged the resp. code from GimpDataList into GimpList. Removed "policy" parameters from gimp_list_new() and added "unique_names". Added new constructor gimp_list_new_weak(). Made public function gimp_list_uniquefy_name() private. * app/core/Makefile.am * app/core/core-types.h * app/core/gimpdatalist.[ch]: removed. Its functionality is entirely in GimpList now. * app/core/gimpdata.[ch]: added gimp_data_name_compare() which used to live in GimpDataList. * app/core/gimp.c * app/core/gimpdatafactory.c * app/core/gimpimage.c * app/core/gimptoolinfo.c * app/core/gimpundostack.c * app/paint/gimp-paint.c * app/tools/gimp-tools.c * app/widgets/gimpdevices.c * app/widgets/gimptemplateeditor.c * app/widgets/gimpundoeditor.c: changed list creation accordingly. Made gimp->templates, gimp->named_buffers, tool_info->presets and the image's lists of layers, channels and vectors automatically ensure unique names. * app/widgets/gimptemplateview.c * app/actions/file-commands.c * app/actions/templates-commands.c * app/actions/tool-options-commands.c: removed calls to gimp_list_uniquefy_name(). * app/core/gimpitem.c: removed major insanity where the items themselves where ensuring their unique names. Bah! * app/core/gimplayer.c (gimp_layer_name_changed): chain up conditionally. * app/core/gimplayermask.c (gimp_layer_mask_name_changed): removed because there is no need any more to keep the parent implementation from being invoked.
This commit is contained in:
committed by
Michael Natterer
parent
d3c7f3fd80
commit
1c62ddef4d
@ -56,19 +56,19 @@ gimp_undo_stack_get_type (void)
|
||||
static const GTypeInfo undo_stack_info =
|
||||
{
|
||||
sizeof (GimpUndoStackClass),
|
||||
(GBaseInitFunc) NULL,
|
||||
(GBaseFinalizeFunc) NULL,
|
||||
(GClassInitFunc) gimp_undo_stack_class_init,
|
||||
NULL, /* class_finalize */
|
||||
NULL, /* class_data */
|
||||
sizeof (GimpUndoStack),
|
||||
0, /* n_preallocs */
|
||||
(GInstanceInitFunc) gimp_undo_stack_init,
|
||||
(GBaseInitFunc) NULL,
|
||||
(GBaseFinalizeFunc) NULL,
|
||||
(GClassInitFunc) gimp_undo_stack_class_init,
|
||||
NULL, /* class_finalize */
|
||||
NULL, /* class_data */
|
||||
sizeof (GimpUndoStack),
|
||||
0, /* n_preallocs */
|
||||
(GInstanceInitFunc) gimp_undo_stack_init,
|
||||
};
|
||||
|
||||
undo_stack_type = g_type_register_static (GIMP_TYPE_UNDO,
|
||||
"GimpUndoStack",
|
||||
&undo_stack_info, 0);
|
||||
"GimpUndoStack",
|
||||
&undo_stack_info, 0);
|
||||
}
|
||||
|
||||
return undo_stack_type;
|
||||
@ -77,13 +77,9 @@ gimp_undo_stack_get_type (void)
|
||||
static void
|
||||
gimp_undo_stack_class_init (GimpUndoStackClass *klass)
|
||||
{
|
||||
GObjectClass *object_class;
|
||||
GimpObjectClass *gimp_object_class;
|
||||
GimpUndoClass *undo_class;
|
||||
|
||||
object_class = G_OBJECT_CLASS (klass);
|
||||
gimp_object_class = GIMP_OBJECT_CLASS (klass);
|
||||
undo_class = GIMP_UNDO_CLASS (klass);
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GimpObjectClass *gimp_object_class = GIMP_OBJECT_CLASS (klass);
|
||||
GimpUndoClass *undo_class = GIMP_UNDO_CLASS (klass);
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
@ -98,16 +94,13 @@ gimp_undo_stack_class_init (GimpUndoStackClass *klass)
|
||||
static void
|
||||
gimp_undo_stack_init (GimpUndoStack *stack)
|
||||
{
|
||||
stack->undos = gimp_list_new (GIMP_TYPE_UNDO,
|
||||
GIMP_CONTAINER_POLICY_STRONG);
|
||||
stack->undos = gimp_list_new (GIMP_TYPE_UNDO, FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_undo_stack_finalize (GObject *object)
|
||||
{
|
||||
GimpUndoStack *stack;
|
||||
|
||||
stack = GIMP_UNDO_STACK (object);
|
||||
GimpUndoStack *stack = GIMP_UNDO_STACK (object);
|
||||
|
||||
if (stack->undos)
|
||||
{
|
||||
@ -122,11 +115,9 @@ static gint64
|
||||
gimp_undo_stack_get_memsize (GimpObject *object,
|
||||
gint64 *gui_size)
|
||||
{
|
||||
GimpUndoStack *stack;
|
||||
GimpUndoStack *stack = GIMP_UNDO_STACK (object);
|
||||
gint64 memsize = 0;
|
||||
|
||||
stack = GIMP_UNDO_STACK (object);
|
||||
|
||||
if (stack->undos)
|
||||
memsize += gimp_object_get_memsize (GIMP_OBJECT (stack->undos), gui_size);
|
||||
|
||||
@ -139,18 +130,14 @@ gimp_undo_stack_pop (GimpUndo *undo,
|
||||
GimpUndoMode undo_mode,
|
||||
GimpUndoAccumulator *accum)
|
||||
{
|
||||
GimpUndoStack *stack;
|
||||
GimpUndoStack *stack = GIMP_UNDO_STACK (undo);
|
||||
GList *list;
|
||||
|
||||
stack = GIMP_UNDO_STACK (undo);
|
||||
|
||||
for (list = GIMP_LIST (stack->undos)->list;
|
||||
list;
|
||||
list = g_list_next (list))
|
||||
{
|
||||
GimpUndo *child;
|
||||
|
||||
child = GIMP_UNDO (list->data);
|
||||
GimpUndo *child = list->data;
|
||||
|
||||
gimp_undo_pop (child, undo_mode, accum);
|
||||
}
|
||||
@ -160,18 +147,14 @@ static void
|
||||
gimp_undo_stack_free (GimpUndo *undo,
|
||||
GimpUndoMode undo_mode)
|
||||
{
|
||||
GimpUndoStack *stack;
|
||||
GimpUndoStack *stack = GIMP_UNDO_STACK (undo);
|
||||
GList *list;
|
||||
|
||||
stack = GIMP_UNDO_STACK (undo);
|
||||
|
||||
for (list = GIMP_LIST (stack->undos)->list;
|
||||
list;
|
||||
list = g_list_next (list))
|
||||
{
|
||||
GimpUndo *child;
|
||||
|
||||
child = GIMP_UNDO (list->data);
|
||||
GimpUndo *child = list->data;
|
||||
|
||||
gimp_undo_free (child, undo_mode);
|
||||
g_object_unref (child);
|
||||
@ -179,7 +162,7 @@ gimp_undo_stack_free (GimpUndo *undo,
|
||||
|
||||
while (GIMP_LIST (stack->undos)->list)
|
||||
gimp_container_remove (GIMP_CONTAINER (stack->undos),
|
||||
GIMP_OBJECT (GIMP_LIST (stack->undos)->list->data));
|
||||
GIMP_LIST (stack->undos)->list->data);
|
||||
}
|
||||
|
||||
GimpUndoStack *
|
||||
|
||||
Reference in New Issue
Block a user