new function.

2001-02-19  Michael Natterer  <mitch@gimp.org>

	* app/gimpcontainer.[ch] (gimp_container_insert): new function.
This commit is contained in:
Michael Natterer 2001-02-19 03:35:55 +00:00 committed by Michael Natterer
parent dbc227137c
commit 6e9296c542
5 changed files with 82 additions and 12 deletions

View File

@ -1,3 +1,7 @@
2001-02-19 Michael Natterer <mitch@gimp.org>
* app/gimpcontainer.[ch] (gimp_container_insert): new function.
2001-02-19 Michael Natterer <mitch@gimp.org>
* app/context_manager.c

View File

@ -291,8 +291,8 @@ gimp_container_add (GimpContainer *container,
if (gimp_container_have (container, object))
{
g_warning ("%s(): container already contains object %p",
G_GNUC_FUNCTION, object);
g_warning ("%s(): container %p already contains object %p",
G_GNUC_FUNCTION, container, object);
return FALSE;
}
@ -347,8 +347,8 @@ gimp_container_remove (GimpContainer *container,
if (! gimp_container_have (container, object))
{
g_warning ("%s(): container does not contains object %p",
G_GNUC_FUNCTION, object);
g_warning ("%s(): container %p does not contain object %p",
G_GNUC_FUNCTION, container, object);
return FALSE;
}
@ -393,6 +393,36 @@ gimp_container_remove (GimpContainer *container,
return TRUE;
}
gboolean
gimp_container_insert (GimpContainer *container,
GimpObject *object,
gint index)
{
g_return_val_if_fail (container != NULL, FALSE);
g_return_val_if_fail (GIMP_IS_CONTAINER (container), FALSE);
g_return_val_if_fail (object != NULL, FALSE);
g_return_val_if_fail (GTK_CHECK_TYPE (object, container->children_type),
FALSE);
g_return_val_if_fail (index >= -1 &&
index <= container->num_children, FALSE);
if (gimp_container_have (container, object))
{
g_warning ("%s(): container %p already contains object %p",
G_GNUC_FUNCTION, container, object);
return FALSE;
}
if (gimp_container_add (container, object))
{
return gimp_container_reorder (container, object, index);
}
return FALSE;
}
gboolean
gimp_container_reorder (GimpContainer *container,
GimpObject *object,
@ -410,8 +440,8 @@ gimp_container_reorder (GimpContainer *container,
if (! gimp_container_have (container, object))
{
g_warning ("%s(): container does not contains object %p",
G_GNUC_FUNCTION, object);
g_warning ("%s(): container %p does not contain object %p",
G_GNUC_FUNCTION, container, object);
return FALSE;
}

View File

@ -90,6 +90,9 @@ gboolean gimp_container_add (GimpContainer *container,
GimpObject *object);
gboolean gimp_container_remove (GimpContainer *container,
GimpObject *object);
gboolean gimp_container_insert (GimpContainer *container,
GimpObject *object,
gint new_index);
gboolean gimp_container_reorder (GimpContainer *container,
GimpObject *object,
gint new_index);

View File

@ -291,8 +291,8 @@ gimp_container_add (GimpContainer *container,
if (gimp_container_have (container, object))
{
g_warning ("%s(): container already contains object %p",
G_GNUC_FUNCTION, object);
g_warning ("%s(): container %p already contains object %p",
G_GNUC_FUNCTION, container, object);
return FALSE;
}
@ -347,8 +347,8 @@ gimp_container_remove (GimpContainer *container,
if (! gimp_container_have (container, object))
{
g_warning ("%s(): container does not contains object %p",
G_GNUC_FUNCTION, object);
g_warning ("%s(): container %p does not contain object %p",
G_GNUC_FUNCTION, container, object);
return FALSE;
}
@ -393,6 +393,36 @@ gimp_container_remove (GimpContainer *container,
return TRUE;
}
gboolean
gimp_container_insert (GimpContainer *container,
GimpObject *object,
gint index)
{
g_return_val_if_fail (container != NULL, FALSE);
g_return_val_if_fail (GIMP_IS_CONTAINER (container), FALSE);
g_return_val_if_fail (object != NULL, FALSE);
g_return_val_if_fail (GTK_CHECK_TYPE (object, container->children_type),
FALSE);
g_return_val_if_fail (index >= -1 &&
index <= container->num_children, FALSE);
if (gimp_container_have (container, object))
{
g_warning ("%s(): container %p already contains object %p",
G_GNUC_FUNCTION, container, object);
return FALSE;
}
if (gimp_container_add (container, object))
{
return gimp_container_reorder (container, object, index);
}
return FALSE;
}
gboolean
gimp_container_reorder (GimpContainer *container,
GimpObject *object,
@ -410,8 +440,8 @@ gimp_container_reorder (GimpContainer *container,
if (! gimp_container_have (container, object))
{
g_warning ("%s(): container does not contains object %p",
G_GNUC_FUNCTION, object);
g_warning ("%s(): container %p does not contain object %p",
G_GNUC_FUNCTION, container, object);
return FALSE;
}

View File

@ -90,6 +90,9 @@ gboolean gimp_container_add (GimpContainer *container,
GimpObject *object);
gboolean gimp_container_remove (GimpContainer *container,
GimpObject *object);
gboolean gimp_container_insert (GimpContainer *container,
GimpObject *object,
gint new_index);
gboolean gimp_container_reorder (GimpContainer *container,
GimpObject *object,
gint new_index);