removed the "floating" flag and the floating/sink API.

2006-10-16  Michael Natterer  <mitch@gimp.org>

	* app/core/gimpitem.[ch]: removed the "floating" flag and the
	floating/sink API.

	(gimp_item_init): call g_object_force_floating() instead.

	* app/core/gimpimage.c
	* app/core/gimplayer.c
	* app/xcf/xcf-load.c
	* tools/pdbgen/pdb/drawable.pdb
	* tools/pdbgen/pdb/image.pdb: use combinations of
	g_object_ref_sink() and g_object_unref() instead of
	gimp_item_sink(). Use g_object_is_floating() instead of
	gimp_item_is_floating().

	* app/pdb/drawable_cmds.c
	* app/pdb/image_cmds.c: regenerated.
This commit is contained in:
Michael Natterer 2006-10-16 17:09:17 +00:00 committed by Michael Natterer
parent 349a0d7094
commit b72ffb8b49
10 changed files with 46 additions and 59 deletions

View File

@ -1,3 +1,22 @@
2006-10-16 Michael Natterer <mitch@gimp.org>
* app/core/gimpitem.[ch]: removed the "floating" flag and the
floating/sink API.
(gimp_item_init): call g_object_force_floating() instead.
* app/core/gimpimage.c
* app/core/gimplayer.c
* app/xcf/xcf-load.c
* tools/pdbgen/pdb/drawable.pdb
* tools/pdbgen/pdb/image.pdb: use combinations of
g_object_ref_sink() and g_object_unref() instead of
gimp_item_sink(). Use g_object_is_floating() instead of
gimp_item_is_floating().
* app/pdb/drawable_cmds.c
* app/pdb/image_cmds.c: regenerated.
2006-10-16 Kevin Cozens <kcozens@cvs.gnome.org>
* configure.in: Set enable_python to yes if it wasn't set to no.

View File

@ -680,8 +680,7 @@ gimp_image_constructor (GType type,
image->selection_mask = gimp_selection_new (image,
image->width,
image->height);
g_object_ref (image->selection_mask);
gimp_item_sink (GIMP_ITEM (image->selection_mask));
g_object_ref_sink (image->selection_mask);
g_signal_connect (image->selection_mask, "update",
G_CALLBACK (gimp_image_mask_update),
@ -2795,8 +2794,9 @@ gimp_image_add_layer (GimpImage *image,
if (position > gimp_container_num_children (image->layers))
position = gimp_container_num_children (image->layers);
g_object_ref_sink (layer);
gimp_container_insert (image->layers, GIMP_OBJECT (layer), position);
gimp_item_sink (GIMP_ITEM (layer));
g_object_unref (layer);
/* notify the layers dialog of the currently active layer */
gimp_image_set_active_layer (image, layer);
@ -3059,8 +3059,9 @@ gimp_image_add_channel (GimpImage *image,
if (position > gimp_container_num_children (image->channels))
position = gimp_container_num_children (image->channels);
g_object_ref_sink (channel);
gimp_container_insert (image->channels, GIMP_OBJECT (channel), position);
gimp_item_sink (GIMP_ITEM (channel));
g_object_unref (channel);
/* notify this image of the currently active channel */
gimp_image_set_active_channel (image, channel);
@ -3310,8 +3311,9 @@ gimp_image_add_vectors (GimpImage *image,
if (position > gimp_container_num_children (image->vectors))
position = gimp_container_num_children (image->vectors);
g_object_ref_sink (vectors);
gimp_container_insert (image->vectors, GIMP_OBJECT (vectors), position);
gimp_item_sink (GIMP_ITEM (vectors));
g_object_unref (vectors);
/* notify this image of the currently active vectors */
gimp_image_set_active_vectors (image, vectors);

View File

@ -197,6 +197,8 @@ gimp_item_class_init (GimpItemClass *klass)
static void
gimp_item_init (GimpItem *item)
{
g_object_force_floating (G_OBJECT (item));
item->ID = 0;
item->tattoo = 0;
item->image = NULL;
@ -207,7 +209,6 @@ gimp_item_init (GimpItem *item)
item->offset_y = 0;
item->visible = TRUE;
item->linked = FALSE;
item->floating = TRUE;
item->removed = FALSE;
}
@ -407,41 +408,6 @@ gimp_item_real_resize (GimpItem *item,
g_object_notify (G_OBJECT (item), "height");
}
/**
* gimp_item_is_floating:
* @item: the #GimpItem to check.
*
* Returns: #TRUE if the item is floating.
*/
gboolean
gimp_item_is_floating (const GimpItem *item)
{
g_return_val_if_fail (GIMP_IS_ITEM (item), FALSE);
return item->floating;
}
/**
* gimp_item_sink:
* @item: the #GimpItem to sink.
*
* If @item is floating, this function sets it so that
* it is not, and removes a reference to it. If @item
* is not floating, the function does nothing.
*/
void
gimp_item_sink (GimpItem *item)
{
g_return_if_fail (GIMP_IS_ITEM (item));
if (item->floating)
{
item->floating = FALSE;
g_object_unref (item);
}
}
/**
* gimp_item_remove:
* @item: the #GimpItem to remove.

View File

@ -50,7 +50,6 @@ struct _GimpItem
gboolean visible; /* control visibility */
gboolean linked; /* control linkage */
gboolean floating; /* added to an image? */
gboolean removed; /* removed from the image? */
};
@ -128,9 +127,6 @@ struct _GimpItemClass
GType gimp_item_get_type (void) G_GNUC_CONST;
gboolean gimp_item_is_floating (const GimpItem *item);
void gimp_item_sink (GimpItem *item);
void gimp_item_removed (GimpItem *item);
gboolean gimp_item_is_removed (const GimpItem *item);

View File

@ -1255,8 +1255,7 @@ gimp_layer_add_mask (GimpLayer *layer,
gimp_image_undo_push_layer_mask_add (image, _("Add Layer Mask"),
layer, mask);
layer->mask = g_object_ref (mask);
gimp_item_sink (GIMP_ITEM (layer->mask));
layer->mask = g_object_ref_sink (mask);
gimp_layer_mask_set_layer (mask, layer);

View File

@ -59,8 +59,11 @@ drawable_delete_invoker (GimpProcedure *procedure,
if (success)
{
if (gimp_item_is_floating (GIMP_ITEM (drawable)))
gimp_item_sink (GIMP_ITEM (drawable));
if (g_object_is_floating (drawable))
{
g_object_ref_sink (drawable);
g_object_unref (drawable);
}
else
success = FALSE;
}

View File

@ -792,7 +792,7 @@ image_add_layer_invoker (GimpProcedure *procedure,
if (success)
{
if (! gimp_item_is_floating (GIMP_ITEM (layer)) ||
if (! g_object_is_floating (layer) ||
GIMP_IMAGE_TYPE_BASE_TYPE (gimp_drawable_type (GIMP_DRAWABLE (layer))) !=
gimp_image_base_type (image))
{
@ -935,7 +935,7 @@ image_add_channel_invoker (GimpProcedure *procedure,
if (success)
{
if (gimp_item_is_floating (GIMP_ITEM (channel)))
if (g_object_is_floating (channel))
success = gimp_image_add_channel (image, channel, MAX (position, -1));
else
success = FALSE;
@ -1028,7 +1028,7 @@ image_add_vectors_invoker (GimpProcedure *procedure,
if (success)
{
if (gimp_item_is_floating (GIMP_ITEM (vectors)))
if (g_object_is_floating (vectors))
success = gimp_image_add_vectors (image, vectors, MAX (position, -1));
else
success = FALSE;

View File

@ -785,8 +785,7 @@ xcf_load_channel_props (XcfInfo *info,
gimp_selection_new (image,
gimp_item_width (GIMP_ITEM (*channel)),
gimp_item_height (GIMP_ITEM (*channel)));
g_object_ref (image->selection_mask);
gimp_item_sink (GIMP_ITEM (image->selection_mask));
g_object_ref_sink (image->selection_mask);
tile_manager_unref (GIMP_DRAWABLE (image->selection_mask)->tiles);
GIMP_DRAWABLE (image->selection_mask)->tiles =

View File

@ -1194,8 +1194,11 @@ HELP
%invoke = (
code => <<'CODE'
{
if (gimp_item_is_floating (GIMP_ITEM (drawable)))
gimp_item_sink (GIMP_ITEM (drawable));
if (g_object_is_floating (drawable))
{
g_object_ref_sink (drawable);
g_object_unref (drawable);
}
else
success = FALSE;
}

View File

@ -899,7 +899,7 @@ HELP
$invoke{code} = <<'CODE';
{
if (! gimp_item_is_floating (GIMP_ITEM (layer)) ||
if (! g_object_is_floating (layer) ||
GIMP_IMAGE_TYPE_BASE_TYPE (gimp_drawable_type (GIMP_DRAWABLE (layer))) !=
gimp_image_base_type (image))
{
@ -1061,7 +1061,7 @@ HELP
%invoke = (
code => <<'CODE'
{
if (gimp_item_is_floating (GIMP_ITEM (channel)))
if (g_object_is_floating (channel))
success = gimp_image_add_channel (image, channel, MAX (position, -1));
else
success = FALSE;
@ -1118,7 +1118,7 @@ HELP
$invoke{code} = <<'CODE';
{
if (gimp_item_is_floating (GIMP_ITEM (vectors)))
if (g_object_is_floating (vectors))
success = gimp_image_add_vectors (image, vectors, MAX (position, -1));
else
success = FALSE;