Commit cbcf4650 authored by Michael Natterer's avatar Michael Natterer 😴

Fix up dynamics loading/saving

parent 72e976cc
......@@ -17,44 +17,36 @@
#include "config.h"
#include <errno.h>
#include <glib-object.h>
#include <glib/gstdio.h>
#include "libgimpbase/gimpbase.h"
#ifdef G_OS_WIN32
#include "libgimpbase/gimpwin32-io.h"
#endif
#include "libgimpconfig/gimpconfig.h"
#include "core-types.h"
#include "gimpdynamics.h"
#include "gimpdynamics-load.h"
#include "gimp-intl.h"
GList *
gimp_dynamics_load (const gchar *filename,
GError **error)
{
GimpDynamics *dynamics = g_object_new(GIMP_TYPE_DYNAMICS,
"name", "Default",
NULL);
GimpDynamics *dynamics;
g_return_val_if_fail (filename != NULL, NULL);
g_return_val_if_fail (g_path_is_absolute (filename), NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
gimp_config_deserialize_file (dynamics,
filename, NULL, NULL);
dynamics = g_object_new (GIMP_TYPE_DYNAMICS, NULL);
if (gimp_config_deserialize_file (GIMP_CONFIG (dynamics),
filename,
NULL, error))
{
return g_list_prepend (NULL, dynamics);
}
/* g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_OPEN,
_("Could not open '%s' for reading: %s"),
gimp_filename_to_utf8 (filename), g_strerror (errno));*/
g_object_unref (dynamics);
return g_list_prepend (NULL, dynamics);
return NULL;
}
......@@ -17,42 +17,26 @@
#include "config.h"
#include <errno.h>
#include <glib-object.h>
#include <glib/gstdio.h>
#include "libgimpbase/gimpbase.h"
#include "libgimpconfig/gimpconfig.h"
#include "core-types.h"
#include "gimpdynamics.h"
#include "gimpdynamics-save.h"
#include "gimpdynamics-load.h"
#include "config/gimpconfig-file.h"
#include "gimp-intl.h"
gboolean
gimp_dynamics_save (GimpData *data,
GError **error)
{
GimpDynamics *dynamics;
FILE *file;
GError *myerror = NULL;
g_return_val_if_fail (GIMP_IS_DYNAMICS (data), FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
dynamics = GIMP_DYNAMICS (data);
if(!gimp_config_serialize_to_file(dynamics, g_strconcat(data->filename, GIMP_DYNAMICS_FILE_EXTENSION, NULL), "GIMP dynamics save file", "", &myerror))
{
g_message ("%s", myerror->message);
g_error_free (myerror);
}
return TRUE;
return gimp_config_serialize_to_file (GIMP_CONFIG (data),
data->filename,
"GIMP dynamics file",
"end of GIMP dynamics file",
NULL, error);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment