[gnome-games/wip/exalm/runner-refactor: 23/56] retro-runner: Generalize save_screenshot_in_tmp()



commit 5f12101def25c82c6ef56d3239bb8b5be4cba651
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Fri Mar 6 17:00:22 2020 +0500

    retro-runner: Generalize save_screenshot_in_tmp()
    
    Pass arbitrary path into it and rename to save_screenshot()

 src/retro/retro-runner.vala | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
---
diff --git a/src/retro/retro-runner.vala b/src/retro/retro-runner.vala
index a48b663e..6ed90cbf 100644
--- a/src/retro/retro-runner.vala
+++ b/src/retro/retro-runner.vala
@@ -552,13 +552,11 @@ public class Games.RetroRunner : Object, Runner {
                core.load_memory (Retro.MemoryType.SAVE_RAM, save_ram_path);
        }
 
-       private void save_screenshot_in_tmp () throws Error {
+       private void save_screenshot (string path) throws Error {
                var pixbuf = current_state_pixbuf;
                if (pixbuf == null)
                        return;
 
-               var screenshot_path = tmp_live_savestate.get_screenshot_path ();
-
                var now = new GLib.DateTime.now_local ();
                var creation_time = now.to_string ();
                var game_title = game.name;
@@ -574,7 +572,7 @@ public class Games.RetroRunner : Object, Runner {
                // See http://www.libpng.org/pub/png/spec/iso/index-object.html#11textinfo
                // for description of used keys. "Game Title" and "Platform" are
                // non-standard fields as allowed by PNG specification.
-               pixbuf.save (screenshot_path, "png",
+               pixbuf.save (path, "png",
                             "tEXt::Software", "GNOME Games",
                             "tEXt::Title", @"Screenshot of $game_title on $platform_name",
                             "tEXt::Creation Time", creation_time.to_string (),
@@ -642,7 +640,7 @@ public class Games.RetroRunner : Object, Runner {
                        savestate.set_media_data (media_set);
 
                core.save_state (savestate.get_snapshot_path ());
-               save_screenshot_in_tmp ();
+               save_screenshot (savestate.get_screenshot_path ());
                savestate.screenshot_aspect_ratio = Retro.pixbuf_get_aspect_ratio (current_state_pixbuf);
        }
 


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