From 170901c5ebbb7cdeda5bf62756bf2acd3f381eda Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Sat, 18 Nov 2006 16:19:47 +0000 Subject: [PATCH] applied patch from Jernej Simoncic which enables environment variables and 2006-11-18 Michael Natterer * app/plug-in/plug-in-rc.c (plug_in_def_deserialize): applied patch from Jernej Simoncic which enables environment variables and ${gimp_foo} variables in plug-in filename and converts them to filesystem encoding. Fixes bug #375349. (plug_in_rc_write): write UTF-8 filenames to pluginrc. --- ChangeLog | 9 +++++++++ app/plug-in/plug-in-rc.c | 21 ++++++++++++++++++--- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 288f3893f3..fb35c6a0f4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2006-11-18 Michael Natterer + + * app/plug-in/plug-in-rc.c (plug_in_def_deserialize): applied + patch from Jernej Simoncic which enables environment variables and + ${gimp_foo} variables in plug-in filename and converts them to + filesystem encoding. Fixes bug #375349. + + (plug_in_rc_write): write UTF-8 filenames to pluginrc. + 2006-11-18 Simon Budig * plug-ins/script-fu/script-fu-scripts.c: Properly handle PDB_LAYERs diff --git a/app/plug-in/plug-in-rc.c b/app/plug-in/plug-in-rc.c index 512aa355f1..0ccf49d547 100644 --- a/app/plug-in/plug-in-rc.c +++ b/app/plug-in/plug-in-rc.c @@ -233,20 +233,27 @@ plug_in_def_deserialize (Gimp *gimp, PlugInDef *plug_in_def; GimpPlugInProcedure *proc = NULL; gchar *name; + gchar *path; + gint mtime; GTokenType token; if (! gimp_scanner_parse_string (scanner, &name)) return G_TOKEN_STRING; - plug_in_def = plug_in_def_new (name); + path = gimp_config_path_expand (name, TRUE, NULL); g_free (name); - if (! gimp_scanner_parse_int (scanner, (gint *) &plug_in_def->mtime)) + plug_in_def = plug_in_def_new (path); + g_free (path); + + if (! gimp_scanner_parse_int (scanner, &mtime)) { plug_in_def_free (plug_in_def); return G_TOKEN_INT; } + plug_in_def->mtime = mtime; + token = G_TOKEN_LEFT_PAREN; while (g_scanner_peek_next_token (scanner) == token) @@ -777,11 +784,19 @@ plug_in_rc_write (GSList *plug_in_defs, if (plug_in_def->procedures) { GSList *list2; + gchar *utf8; + + utf8 = g_filename_to_utf8 (plug_in_def->prog, -1, NULL, NULL, NULL); + + if (! utf8) + continue; gimp_config_writer_open (writer, "plug-in-def"); - gimp_config_writer_string (writer, plug_in_def->prog); + gimp_config_writer_string (writer, utf8); gimp_config_writer_printf (writer, "%ld", plug_in_def->mtime); + g_free (utf8); + for (list2 = plug_in_def->procedures; list2; list2 = list2->next) { GimpPlugInProcedure *proc = list2->data;