[gnome-games/wip/exalm/ds: 2/9] savestate: Add save_extra_metadata()



commit e0f28656c5d4d98c053ec1394a235d9897cc970b
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date:   Tue Aug 13 13:56:34 2019 +0500

    savestate: Add save_extra_metadata()
    
    Now that we have functions for supplying extra metadata into savestates,
    we need to actually write it. For this, introduce a virtual function that
    is called from set_metadata(), allowing subclasses to override it and save
    the extra data.

 src/core/savestate.vala | 6 ++++++
 1 file changed, 6 insertions(+)
---
diff --git a/src/core/savestate.vala b/src/core/savestate.vala
index 4d40da97..7abdce7e 100644
--- a/src/core/savestate.vala
+++ b/src/core/savestate.vala
@@ -165,6 +165,9 @@ public class Games.Savestate : Object {
                set_metadata (false, name, creation_date, platform, core, aspect_ratio);
        }
 
+       protected virtual void save_extra_metadata (KeyFile keyfile) {
+       }
+
        private void set_metadata (bool is_automatic, string? name, DateTime creation_date,
                                   string platform, string core, double aspect_ratio) throws Error {
                var metadata_file_path = Path.build_filename (path, "metadata");
@@ -183,6 +186,9 @@ public class Games.Savestate : Object {
                metadata.set_string ("Metadata", "Platform", platform);
                metadata.set_string ("Metadata", "Core", core);
                metadata.set_double ("Screenshot", "Aspect Ratio", aspect_ratio);
+
+               save_extra_metadata (metadata);
+
                metadata.save_to_file (metadata_file_path);
        }
 


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