[gnome-boxes/gnome-42] Revert "actions-popover: Save screenshots into ~/Pictures/Screenshots"



commit eb7dc52dad3c182783d5bf1c866d47f52afa8d43
Author: Felipe Borges <felipeborges gnome org>
Date:   Mon Apr 25 16:08:00 2022 +0200

    Revert "actions-popover: Save screenshots into ~/Pictures/Screenshots"
    
    This reverts commit c055da29dccc3ffac9f2acc717a9b96489715796.
    
    This breaks the gnome-42 freeze.

 src/actions-popover.vala | 21 ++++-----------------
 1 file changed, 4 insertions(+), 17 deletions(-)
---
diff --git a/src/actions-popover.vala b/src/actions-popover.vala
index 9f2ea8de..2700180f 100644
--- a/src/actions-popover.vala
+++ b/src/actions-popover.vala
@@ -104,35 +104,22 @@ private void open_in_new_win_activated () {
         App.app.open_in_new_window (window.current_item as Machine);
     }
 
-    private string get_screenshot_filename () throws GLib.Error {
-        // Translators: name of the folder under ~/Pictures for screenshots. This is the same folder where 
GNOME Shell saves screenshots.
-        string dir_name = _("Screenshots");
-        string path = Path.build_filename (GLib.Environment.get_user_special_dir 
(GLib.UserDirectory.PICTURES),
-                                           dir_name);
-        var dir = GLib.File.new_for_path (path);
-
-        // Lets ensure that the "Screenshots" directory really exists.
-        try {
-            dir.make_directory_with_parents (null);
-        } catch (GLib.Error error) {
-            if (!(error is GLib.IOError.EXISTS))
-                throw error;
-        }
-
+    private string get_screenshot_filename () {
         var now = new GLib.DateTime.now_local ();
         var timestamp = now.format ("%Y-%m-%d %H-%M-%S");
 
         // Translators: %s => the timestamp of when the screenshot was taken.
         var filename =_("Screenshot from %s").printf (timestamp);
 
-        return Path.build_filename (dir.get_path (), filename + ".png");
+        return Path.build_filename (GLib.Environment.get_user_special_dir (GLib.UserDirectory.PICTURES),
+                                    filename);
     }
 
     private void take_screenshot_activated () {
         var machine = window.current_item as Machine;
         try {
             Gdk.Pixbuf pixbuf = machine.display.get_pixbuf (0);
-            pixbuf.save (get_screenshot_filename (), "png");
+            pixbuf.save (get_screenshot_filename () + ".png", "png");
         } catch (GLib.Error error) {
             warning (error.message);
         }


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