gimp r24569 - in trunk: . app/file
- From: neo svn gnome org
- To: svn-commits-list gnome org
- Subject: gimp r24569 - in trunk: . app/file
- Date: Tue, 8 Jan 2008 11:01:34 +0000 (GMT)
Author: neo
Date: Tue Jan 8 11:01:34 2008
New Revision: 24569
URL: http://svn.gnome.org/viewvc/gimp?rev=24569&view=rev
Log:
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.
Modified:
trunk/ChangeLog
trunk/app/file/file-open.c
Modified: trunk/app/file/file-open.c
==============================================================================
--- trunk/app/file/file-open.c (original)
+++ trunk/app/file/file-open.c Tue Jan 8 11:01:34 2008
@@ -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 @@
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 @@
{
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 @@
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 @@
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,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]