[gimp] libgimpwidgets: store profile locations as config paths in profilerc
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] libgimpwidgets: store profile locations as config paths in profilerc
- Date: Sun, 4 Sep 2016 13:18:11 +0000 (UTC)
commit 7ce538b85f4dbe47128bb4df4360baf76f1822bd
Author: Michael Natterer <mitch gimp org>
Date: Sun Sep 4 14:20:57 2016 +0200
libgimpwidgets: store profile locations as config paths in profilerc
so we can potentially ship profiles and they will be found reliably,
and users can store profiles in their gimpdir. Still parses the old
uri-based locations.
libgimpwidgets/gimpcolorprofilestore.c | 47 +++++++++++++++++++++++--------
1 files changed, 35 insertions(+), 12 deletions(-)
---
diff --git a/libgimpwidgets/gimpcolorprofilestore.c b/libgimpwidgets/gimpcolorprofilestore.c
index 0e57fbd..43a0a67 100644
--- a/libgimpwidgets/gimpcolorprofilestore.c
+++ b/libgimpwidgets/gimpcolorprofilestore.c
@@ -626,12 +626,28 @@ gimp_color_profile_store_load_profile (GimpColorProfileStore *store,
{
GtkTreeIter iter;
gchar *label = NULL;
- gchar *uri = NULL;
+ gchar *path = NULL;
if (gimp_scanner_parse_string (scanner, &label) &&
- gimp_scanner_parse_string (scanner, &uri))
+ gimp_scanner_parse_string (scanner, &path))
{
- GFile *file = g_file_new_for_uri (uri);
+ GFile *file = NULL;
+
+ if (g_str_has_prefix (path, "file://"))
+ {
+ file = g_file_new_for_uri (path);
+ }
+ else
+ {
+ gchar *expand = gimp_config_path_expand (path, TRUE, NULL);
+
+ if (expand)
+ {
+ file = g_file_new_for_path (expand);
+
+ g_free (expand);
+ }
+ }
if (file)
{
@@ -645,13 +661,13 @@ gimp_color_profile_store_load_profile (GimpColorProfileStore *store,
}
g_free (label);
- g_free (uri);
+ g_free (path);
return G_TOKEN_RIGHT_PAREN;
}
g_free (label);
- g_free (uri);
+ g_free (path);
return G_TOKEN_STRING;
}
@@ -763,16 +779,23 @@ gimp_color_profile_store_save (GimpColorProfileStore *store,
{
if (files[i] && labels[i])
{
- gchar *uri = g_file_get_uri (files[i]);
+ gchar *path = g_file_get_path (files[i]);
- if (uri)
+ if (path)
{
- gimp_config_writer_open (writer, "color-profile");
- gimp_config_writer_string (writer, labels[i]);
- gimp_config_writer_string (writer, uri);
- gimp_config_writer_close (writer);
+ gchar *unexpand = gimp_config_path_unexpand (path, TRUE, NULL);
+
+ if (unexpand)
+ {
+ gimp_config_writer_open (writer, "color-profile");
+ gimp_config_writer_string (writer, labels[i]);
+ gimp_config_writer_string (writer, unexpand);
+ gimp_config_writer_close (writer);
+
+ g_free (unexpand);
+ }
- g_free (uri);
+ g_free (path);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]