parse the first line of the file manually and detect whether we are
2008-06-25 Michael Natterer <mitch@gimp.org> * app/tools/gimpcurvestool.c (gimp_curves_tool_settings_import): parse the first line of the file manually and detect whether we are importing an old curves file or a GimpConfig one. svn path=/trunk/; revision=25988
This commit is contained in:

committed by
Michael Natterer

parent
e9c8fed84f
commit
7df6950e19
@ -1,3 +1,9 @@
|
|||||||
|
2008-06-25 Michael Natterer <mitch@gimp.org>
|
||||||
|
|
||||||
|
* app/tools/gimpcurvestool.c (gimp_curves_tool_settings_import):
|
||||||
|
parse the first line of the file manually and detect whether we
|
||||||
|
are importing an old curves file or a GimpConfig one.
|
||||||
|
|
||||||
2008-06-25 Michael Natterer <mitch@gimp.org>
|
2008-06-25 Michael Natterer <mitch@gimp.org>
|
||||||
|
|
||||||
* app/gegl/gimpcurvesconfig.c (gimp_curves_config_load_cruft):
|
* app/gegl/gimpcurvesconfig.c (gimp_curves_config_load_cruft):
|
||||||
|
@ -584,6 +584,7 @@ gimp_curves_tool_settings_import (GimpImageMapTool *image_map_tool,
|
|||||||
GimpCurvesTool *tool = GIMP_CURVES_TOOL (image_map_tool);
|
GimpCurvesTool *tool = GIMP_CURVES_TOOL (image_map_tool);
|
||||||
FILE *file;
|
FILE *file;
|
||||||
gboolean success;
|
gboolean success;
|
||||||
|
gchar header[64];
|
||||||
|
|
||||||
file = g_fopen (filename, "rt");
|
file = g_fopen (filename, "rt");
|
||||||
|
|
||||||
@ -596,6 +597,20 @@ gimp_curves_tool_settings_import (GimpImageMapTool *image_map_tool,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (! fgets (header, sizeof (header), file))
|
||||||
|
{
|
||||||
|
g_set_error (error, G_FILE_ERROR, g_file_error_from_errno (errno),
|
||||||
|
_("Could not read header from '%s': %s"),
|
||||||
|
gimp_filename_to_utf8 (filename),
|
||||||
|
g_strerror (errno));
|
||||||
|
fclose (file);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (g_str_has_prefix (header, "# GIMP Curves File\n"))
|
||||||
|
{
|
||||||
|
rewind (file);
|
||||||
|
|
||||||
success = gimp_curves_config_load_cruft (tool->config, file, error);
|
success = gimp_curves_config_load_cruft (tool->config, file, error);
|
||||||
|
|
||||||
fclose (file);
|
fclose (file);
|
||||||
@ -603,6 +618,13 @@ gimp_curves_tool_settings_import (GimpImageMapTool *image_map_tool,
|
|||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fclose (file);
|
||||||
|
|
||||||
|
return GIMP_IMAGE_MAP_TOOL_CLASS (parent_class)->settings_import (image_map_tool,
|
||||||
|
filename,
|
||||||
|
error);
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gimp_curves_tool_settings_export (GimpImageMapTool *image_map_tool,
|
gimp_curves_tool_settings_export (GimpImageMapTool *image_map_tool,
|
||||||
const gchar *filename,
|
const gchar *filename,
|
||||||
|
Reference in New Issue
Block a user