[gimp/soc-2009-dynamics] Fix up dynamics loading/saving
- From: Michael Natterer <mitch src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gimp/soc-2009-dynamics] Fix up dynamics loading/saving
- Date: Sat, 10 Oct 2009 18:39:32 +0000 (UTC)
commit cbcf46506ca7fb027029044f073660718102e327
Author: Michael Natterer <mitch gimp org>
Date: Sat Oct 10 20:39:11 2009 +0200
Fix up dynamics loading/saving
app/core/gimpdynamics-load.c | 32 ++++++++++++--------------------
app/core/gimpdynamics-save.c | 28 ++++++----------------------
2 files changed, 18 insertions(+), 42 deletions(-)
---
diff --git a/app/core/gimpdynamics-load.c b/app/core/gimpdynamics-load.c
index 1e787cf..79ca153 100644
--- a/app/core/gimpdynamics-load.c
+++ b/app/core/gimpdynamics-load.c
@@ -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;
}
diff --git a/app/core/gimpdynamics-save.c b/app/core/gimpdynamics-save.c
index e0d9008..d98c440 100644
--- a/app/core/gimpdynamics-save.c
+++ b/app/core/gimpdynamics-save.c
@@ -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);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]