[gimp] app: Name layers of imported files to filename
- From: Martin Nordholts <martinn src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gimp] app: Name layers of imported files to filename
- Date: Sat, 22 Aug 2009 08:38:55 +0000 (UTC)
commit b574ae9275249a79b874c45e9433e383a5dad8a9
Author: Martin Nordholts <martinn src gnome org>
Date: Sat Aug 22 10:11:35 2009 +0200
app: Name layers of imported files to filename
After having imported a single-layered image, rename the layer to the
file name.
app/file/file-open.c | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/app/file/file-open.c b/app/file/file-open.c
index 3697e3a..93ceca7 100644
--- a/app/file/file-open.c
+++ b/app/file/file-open.c
@@ -425,6 +425,23 @@ 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]