[easytag/wip/future-gtk: 31/31] Use g_key_file_save_to_file()



commit 46f6dc2e311c1a3f28b5003783e1f495a03b940b
Author: David King <amigadave amigadave com>
Date:   Fri Jan 15 18:46:47 2016 +0000

    Use g_key_file_save_to_file()
    
    Simplify the saving of window state.

 src/application_window.c |    8 +-------
 1 files changed, 1 insertions(+), 7 deletions(-)
---
diff --git a/src/application_window.c b/src/application_window.c
index c05e2e2..ad406f6 100644
--- a/src/application_window.c
+++ b/src/application_window.c
@@ -112,8 +112,6 @@ save_state (EtApplicationWindow *self)
     EtApplicationWindowPrivate *priv;
     gchar *path;
     GKeyFile *keyfile;
-    gchar *buffer;
-    gsize length;
     GError *error = NULL;
 
     priv = et_application_window_get_instance_private (self);
@@ -150,16 +148,12 @@ save_state (EtApplicationWindow *self)
     g_key_file_set_integer (keyfile, "EtApplicationWindow", "paned_position",
                             priv->paned_position);
 
-    /* TODO; Use g_key_file_save_to_file() in GLib 2.40. */
-    buffer = g_key_file_to_data (keyfile, &length, NULL);
-
-    if (!g_file_set_contents (path, buffer, length, &error))
+    if (!g_key_file_save_to_file (keyfile, path, &error))
     {
         g_warning ("Error saving window state: %s", error->message);
         g_error_free (error);
     }
 
-    g_free (buffer);
     g_free (path);
     g_key_file_free (keyfile);
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]