[gimp] Use ${gimp_dir} and ${gimp_data_dir} in tags.xml
- From: Michael Natterer <mitch src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gimp] Use ${gimp_dir} and ${gimp_data_dir} in tags.xml
- Date: Sat, 7 Nov 2009 20:18:47 +0000 (UTC)
commit 3a8b59ada578e400e2801723b8c84b9c6b3c791f
Author: Michael Natterer <mitch gimp org>
Date: Sat Nov 7 21:14:56 2009 +0100
Use ${gimp_dir} and ${gimp_data_dir} in tags.xml
* app/core/gimpdata.c (gimp_data_get_identifier): check if the data's
path starts with either of those and use the symbolic paths in that
case.
* data/tags/gimp-tags-default.xml.in: use them here too instead of
/home/martin/foo/bar/...
This way we can ship a default file that makes sense, and need much
less identifier remapping. The identifiers even stay the same when
upgrading GIMP.
app/core/gimpdata.c | 26 +++++++++++++++++++++++++-
data/tags/gimp-tags-default.xml.in | 4 ++--
2 files changed, 27 insertions(+), 3 deletions(-)
---
diff --git a/app/core/gimpdata.c b/app/core/gimpdata.c
index ce34751..dadec52 100644
--- a/app/core/gimpdata.c
+++ b/app/core/gimpdata.c
@@ -442,7 +442,31 @@ gimp_data_get_identifier (GimpTagged *tagged)
if (private->filename)
{
- identifier = g_filename_to_utf8 (private->filename, -1, NULL, NULL, NULL);
+ const gchar *data_dir = gimp_data_directory ();
+ const gchar *gimp_dir = gimp_directory ();
+ gchar *tmp;
+
+ if (g_str_has_prefix (private->filename, data_dir))
+ {
+ tmp = g_strconcat ("${gimp_data_dir}",
+ private->filename + strlen (data_dir),
+ NULL);
+ identifier = g_filename_to_utf8 (tmp, -1, NULL, NULL, NULL);
+ g_free (tmp);
+ }
+ else if (g_str_has_prefix (private->filename, gimp_dir))
+ {
+ tmp = g_strconcat ("${gimp_dir}",
+ private->filename + strlen (gimp_dir),
+ NULL);
+ identifier = g_filename_to_utf8 (tmp, -1, NULL, NULL, NULL);
+ g_free (tmp);
+ }
+ else
+ {
+ identifier = g_filename_to_utf8 (private->filename, -1,
+ NULL, NULL, NULL);
+ }
if (! identifier)
{
diff --git a/data/tags/gimp-tags-default.xml.in b/data/tags/gimp-tags-default.xml.in
index 6dfba93..579c0c1 100644
--- a/data/tags/gimp-tags-default.xml.in
+++ b/data/tags/gimp-tags-default.xml.in
@@ -6,13 +6,13 @@
<!-- Please do not use separator characters, such as comma, in tags. -->
<tags>
- <resource identifier="/home/martin/dev/share/gimp/2.0/brushes/Round.vbr" checksum="a7f02530d3bc7484c8f9240cbe9c65b1">
+ <resource identifier="${gimp_data_dir}/brushes/Round.vbr" checksum="a7f02530d3bc7484c8f9240cbe9c65b1">
<tag>
<_thetag>round</_thetag>
</tag>
</resource>
- <resource identifier="/home/martin/dev/share/gimp/2.0/brushes/Round-Fuzzy.vbr" checksum="f8cb2466841104a55e42afce4568d103">
+ <resource identifier="${gimp_data_dir}/brushes/Round-Fuzzy.vbr" checksum="f8cb2466841104a55e42afce4568d103">
<tag>
<_thetag>fuzzy</_thetag>
<_thetag>round</_thetag>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]