Commit f2ecfca1 authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann
Browse files

disable undo while the image is being loaded.

2005-08-05  Sven Neumann  <sven@gimp.org>

	* app/xcf/xcf-load.c (xcf_load_image): disable undo while the
	image is being loaded.

	* app/core/gimpitem.c (gimp_item_parasite_attach): don't try to
	push an undo step if undo is disabled. Gets rid of warnings while
	loading an XCF file with undoable drawable parasites.
parent 04a9e34f
2005-08-05 Sven Neumann <sven@gimp.org>
* app/xcf/xcf-load.c (xcf_load_image): disable undo while the
image is being loaded.
* app/core/gimpitem.c (gimp_item_parasite_attach): don't try to
push an undo step if undo is disabled. Gets rid of warnings while
loading an XCF file with undoable drawable parasites.
2005-08-04 Manish Singh <yosh@gimp.org> 2005-08-04 Manish Singh <yosh@gimp.org>
* plug-ins/pygimp/pygimp-rgb.c: don't wrap deprecated function * plug-ins/pygimp/pygimp-rgb.c: don't wrap deprecated function
......
...@@ -1082,15 +1082,20 @@ gimp_item_parasite_attach (GimpItem *item, ...@@ -1082,15 +1082,20 @@ gimp_item_parasite_attach (GimpItem *item,
g_return_if_fail (GIMP_IS_ITEM (item)); g_return_if_fail (GIMP_IS_ITEM (item));
/* only set the dirty bit manually if we can be saved and the new /* only set the dirty bit manually if we can be saved and the new
* parasite differs from the current one and we arn't undoable * parasite differs from the current one and we aren't undoable
*/ */
if (gimp_parasite_is_undoable (parasite)) if (gimp_parasite_is_undoable (parasite))
{ {
/* do a group in case we have attach_parent set */ /* skip undo if it is disabled, for example while loading an XCF */
gimp_image_undo_group_start (item->gimage, GIMP_UNDO_GROUP_PARASITE_ATTACH, if (gimp_image_undo_is_enabled (item->gimage))
{
gimp_image_undo_group_start (item->gimage,
GIMP_UNDO_GROUP_PARASITE_ATTACH,
_("Attach Parasite")); _("Attach Parasite"));
gimp_image_undo_push_item_parasite (item->gimage, NULL, item, parasite); gimp_image_undo_push_item_parasite (item->gimage,
NULL, item, parasite);
}
} }
else if (gimp_parasite_is_persistent (parasite) && else if (gimp_parasite_is_persistent (parasite) &&
! gimp_parasite_compare (parasite, ! gimp_parasite_compare (parasite,
...@@ -1115,7 +1120,8 @@ gimp_item_parasite_attach (GimpItem *item, ...@@ -1115,7 +1120,8 @@ gimp_item_parasite_attach (GimpItem *item,
gimp_parasite_attach (item->gimage->gimp, parasite); gimp_parasite_attach (item->gimage->gimp, parasite);
} }
if (gimp_parasite_is_undoable (parasite)) if (gimp_parasite_is_undoable (parasite) &&
gimp_image_undo_is_enabled (item->gimage))
{ {
gimp_image_undo_group_end (item->gimage); gimp_image_undo_group_end (item->gimage);
} }
......
...@@ -140,8 +140,10 @@ xcf_load_image (Gimp *gimp, ...@@ -140,8 +140,10 @@ xcf_load_image (Gimp *gimp,
image_type, image_type,
FALSE); FALSE);
gimp_image_undo_disable (gimage);
/* read the image properties */ /* read the image properties */
if (!xcf_load_image_props (info, gimage)) if (! xcf_load_image_props (info, gimage))
goto hard_error; goto hard_error;
/* check for a GimpGrid parasite */ /* check for a GimpGrid parasite */
...@@ -160,7 +162,6 @@ xcf_load_image (Gimp *gimp, ...@@ -160,7 +162,6 @@ xcf_load_image (Gimp *gimp,
} }
} }
while (TRUE) while (TRUE)
{ {
/* read in the offset of the next layer */ /* read in the offset of the next layer */
...@@ -252,6 +253,8 @@ xcf_load_image (Gimp *gimp, ...@@ -252,6 +253,8 @@ xcf_load_image (Gimp *gimp,
if (info->tattoo_state > 0) if (info->tattoo_state > 0)
gimp_image_set_tattoo_state (gimage, info->tattoo_state); gimp_image_set_tattoo_state (gimage, info->tattoo_state);
gimp_image_undo_enable (gimage);
return gimage; return gimage;
error: error:
...@@ -261,6 +264,8 @@ xcf_load_image (Gimp *gimp, ...@@ -261,6 +264,8 @@ xcf_load_image (Gimp *gimp,
g_message ("XCF: This file is corrupt! I have loaded as much\n" g_message ("XCF: This file is corrupt! I have loaded as much\n"
"of it as I can, but it is incomplete."); "of it as I can, but it is incomplete.");
gimp_image_undo_enable (gimage);
return gimage; return gimage;
hard_error: hard_error:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment