moved code to a utility function, in preparation for a possible fix for

2008-01-08  Sven Neumann  <sven@gimp.org>

	* app/file/file-open.c (file_open_layers): moved code to a utility
	function, in preparation for a possible fix for bug #507116.

svn path=/trunk/; revision=24569
This commit is contained in:
Sven Neumann 2008-01-08 11:01:34 +00:00 committed by Sven Neumann
parent 2e951b7f9c
commit ef5cda6abf
2 changed files with 43 additions and 28 deletions

View File

@ -1,3 +1,8 @@
2008-01-08 Sven Neumann <sven@gimp.org>
* app/file/file-open.c (file_open_layers): moved code to a utility
function, in preparation for a possible fix for bug #507116.
2008-01-08 Kevin Cozens <kcozens@cvs.gnome.org>
* plug-ins/script-fu/ftx/ftx.c (foreign_filetype): Test for symlink

View File

@ -65,7 +65,6 @@
#include "plug-in/gimppluginerror.h"
#include "plug-in/plug-in-icc-profile.h"
#include "file-open.h"
#include "file-procedure.h"
#include "file-utils.h"
@ -75,6 +74,9 @@
static void file_open_sanitize_image (GimpImage *image,
gboolean as_new);
static void file_open_convert_items (GimpImage *dest_image,
const gchar *basename,
GList *items);
static void file_open_handle_color_profile (GimpImage *image,
GimpContext *context,
GimpProgress *progress,
@ -409,7 +411,7 @@ file_open_layers (Gimp *gimp,
gimp_image_undo_disable (new_image);
for (list = GIMP_LIST (new_image->layers)->list;
for (list = GIMP_LIST (gimp_image_get_layers (new_image))->list;
list;
list = g_list_next (list))
{
@ -441,31 +443,7 @@ file_open_layers (Gimp *gimp,
{
gchar *basename = file_utils_uri_display_basename (uri);
for (list = layers; list; list = g_list_next (list))
{
GimpLayer *layer = list->data;
GimpItem *item;
item = gimp_item_convert (GIMP_ITEM (layer), dest_image,
G_TYPE_FROM_INSTANCE (layer),
TRUE);
if (layers->next == NULL)
{
gimp_object_set_name (GIMP_OBJECT (item), basename);
}
else
{
gchar *name;
name = g_strdup_printf ("%s - %s", basename,
gimp_object_get_name (GIMP_OBJECT (layer)));
gimp_object_take_name (GIMP_OBJECT (item), name);
}
list->data = item;
}
file_open_convert_items (dest_image, basename, layers);
g_free (basename);
gimp_document_list_add_uri (GIMP_DOCUMENT_LIST (gimp->documents),
@ -479,7 +457,7 @@ file_open_layers (Gimp *gimp,
g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED,
_("Image doesn't contain any layers"));
*status = GIMP_PDB_EXECUTION_ERROR;
}
}
g_object_unref (new_image);
}
@ -580,6 +558,38 @@ file_open_sanitize_image (GimpImage *image,
gimp_image_invalidate_channel_previews (image);
}
/* Converts items from one image to another */
static void
file_open_convert_items (GimpImage *dest_image,
const gchar *basename,
GList *items)
{
GList *list;
for (list = items; list; list = g_list_next (list))
{
GimpItem *src = list->data;
GimpItem *item;
item = gimp_item_convert (src, dest_image,
G_TYPE_FROM_INSTANCE (src), TRUE);
if (g_list_length (items) == 1)
{
gimp_object_set_name (GIMP_OBJECT (item), basename);
}
else
{
gchar *name = g_strdup_printf ("%s - %s", basename,
GIMP_OBJECT (src)->name);
gimp_object_take_name (GIMP_OBJECT (item), name);
}
list->data = item;
}
}
static void
file_open_profile_apply_rgb (GimpImage *image,
GimpContext *context,