Example #1
0
static gboolean
gimp_levels_tool_settings_export (GimpImageMapTool  *image_map_tool,
                                  const gchar       *filename,
                                  GError           **error)
{
  GimpLevelsTool *tool = GIMP_LEVELS_TOOL (image_map_tool);

  if (tool->export_old_format)
    {
      FILE     *file;
      gboolean  success;

      file = g_fopen (filename, "wt");

      if (! file)
        {
          g_set_error (error, G_FILE_ERROR, g_file_error_from_errno (errno),
                       _("Could not open '%s' for writing: %s"),
                       gimp_filename_to_utf8 (filename),
                       g_strerror (errno));
          return FALSE;
        }

      success = gimp_levels_config_save_cruft (tool->config, file, error);

      fclose (file);

      return success;
    }

  return GIMP_IMAGE_MAP_TOOL_CLASS (parent_class)->settings_export (image_map_tool,
                                                                    filename,
                                                                    error);
}
Example #2
0
static gboolean
gimp_levels_tool_settings_export (GimpImageMapTool  *im_tool,
                                  GOutputStream     *output,
                                  GError           **error)
{
  GimpLevelsTool   *tool   = GIMP_LEVELS_TOOL (im_tool);
  GimpLevelsConfig *config = GIMP_LEVELS_CONFIG (im_tool->config);

  if (tool->export_old_format)
    return gimp_levels_config_save_cruft (config, output, error);

  return GIMP_IMAGE_MAP_TOOL_CLASS (parent_class)->settings_export (im_tool,
                                                                    output,
                                                                    error);
}