[gnome-games/wip/exalm/savestates: 15/20] savestate: Inline get_metadata()



commit 03d82444888f9a7cdc45140c11be9813ef2f4d00
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Sun Jan 26 00:44:29 2020 +0500

    savestate: Inline get_metadata()

 src/core/savestate.vala | 20 ++++----------------
 1 file changed, 4 insertions(+), 16 deletions(-)
---
diff --git a/src/core/savestate.vala b/src/core/savestate.vala
index 2d5fa161..60df07b0 100644
--- a/src/core/savestate.vala
+++ b/src/core/savestate.vala
@@ -27,28 +27,16 @@ public class Games.Savestate : Object {
                if (!metadata_file.query_exists ())
                        return;
 
-               var keyfile = get_metadata ();
+               var keyfile = new KeyFile ();
 
                try {
-                       load_metadata (keyfile);
-               }
-               catch (KeyFileError e) {
-                       critical ("Failed to load metadata for snapshot at %s: %s", path, e.message);
-               }
-       }
-
-       protected KeyFile get_metadata () {
-               var metadata = new KeyFile ();
-               var metadata_file_path = Path.build_filename (path, "metadata");
+                       keyfile.load_from_file (metadata_file_path, KeyFileFlags.NONE);
 
-               try {
-                       metadata.load_from_file (metadata_file_path, KeyFileFlags.NONE);
+                       load_metadata (keyfile);
                }
                catch (Error e) {
-                       critical ("Failed to load metadata for %s: %s", path, e.message);
+                       critical ("Failed to load metadata for snapshot at %s: %s", path, e.message);
                }
-
-               return metadata;
        }
 
        public void set_snapshot_data (Bytes snapshot_data) throws Error {


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