[gimp] app: don't gimp_object_set_name() on the image's layer after opening
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: don't gimp_object_set_name() on the image's layer after opening
- Date: Sun, 6 Feb 2011 23:52:21 +0000 (UTC)
commit 0d2de3e7c159d71637caa653df0db7d499ba167f
Author: Michael Natterer <mitch gimp org>
Date: Mon Feb 7 00:50:54 2011 +0100
app: don't gimp_object_set_name() on the image's layer after opening
Instead, use gimp_item_rename(). Also change the name before creating
a display for the image, to avoid confusing the undo dialog.
app/file/file-open.c | 36 +++++++++++++++++++-----------------
1 files changed, 19 insertions(+), 17 deletions(-)
---
diff --git a/app/file/file-open.c b/app/file/file-open.c
index ac0fe54..8417341 100644
--- a/app/file/file-open.c
+++ b/app/file/file-open.c
@@ -402,6 +402,25 @@ file_open_with_proc_and_display (Gimp *gimp,
if (image)
{
+ /* If the file was imported we want to set the layer name to the
+ * file name. For now, assume that multi-layered imported images
+ * have named the layers already, so only rename the layer of
+ * single-layered imported files. Note that this will also
+ * rename already named layers from e.g. single-layered PSD
+ * files. To solve this properly, we would need new file plug-in
+ * API.
+ */
+ if (file_open_file_proc_is_import (file_proc) &&
+ gimp_image_get_n_layers (image) == 1)
+ {
+ GimpObject *layer = gimp_image_get_layer_iter (image)->data;
+ gchar *basename = file_utils_uri_display_basename (uri);
+
+ gimp_item_rename (GIMP_ITEM (layer), basename, NULL);
+ gimp_image_undo_free (image);
+ gimp_image_clean_all (image);
+ }
+
gimp_create_display (image->gimp, image, GIMP_UNIT_PIXEL, 1.0);
if (! as_new)
@@ -424,23 +443,6 @@ file_open_with_proc_and_display (Gimp *gimp,
}
}
- /* If the file was imported we want to set the layer name to the
- * file name. For now, assume that multi-layered imported images
- * have named the layers already, so only rename the layer of
- * single-layered imported files. Note that this will also
- * rename already named layers from e.g. single-layered PSD
- * files. To solve this properly, we would need new file plug-in
- * API.
- */
- if (file_open_file_proc_is_import (file_proc) &&
- gimp_image_get_n_layers (image) == 1)
- {
- GimpObject *layer = gimp_image_get_layer_iter (image)->data;
- gchar *basename = file_utils_uri_display_basename (uri);
-
- gimp_object_take_name (layer, basename);
- }
-
/* the display owns the image now */
g_object_unref (image);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]