environment: Hook up touch_file to GFile prototype

We don't usually extend introspected types with our own API, but in
this case it's too tempting to make the helper functions usable with
Gio._promisify() ...

https://gitlab.gnome.org/GNOME/gnome-shell/issues/2432
This commit is contained in:
Florian Müllner 2020-03-23 18:00:27 +01:00 committed by Florian Müllner
parent f52574bd28
commit 78997cb7eb

View File

@ -10,7 +10,7 @@ imports.gi.versions.Gtk = '3.0';
imports.gi.versions.TelepathyGLib = '0.12'; imports.gi.versions.TelepathyGLib = '0.12';
imports.gi.versions.TelepathyLogger = '0.2'; imports.gi.versions.TelepathyLogger = '0.2';
const { Clutter, GLib, GObject, Meta, Shell, St } = imports.gi; const { Clutter, Gio, GLib, GObject, Meta, Shell, St } = imports.gi;
const Gettext = imports.gettext; const Gettext = imports.gettext;
const System = imports.system; const System = imports.system;
@ -288,6 +288,13 @@ function init() {
}, },
}); });
Gio._LocalFilePrototype.touch_async = function (callback) {
Shell.util_touch_file_async(this, callback);
};
Gio._LocalFilePrototype.touch_finish = function (result) {
return Shell.util_touch_file_finish(this, result);
};
St.set_slow_down_factor = function (factor) { St.set_slow_down_factor = function (factor) {
let { stack } = new Error(); let { stack } = new Error();
log(`St.set_slow_down_factor() is deprecated, use St.Settings.slow_down_factor\n${stack}`); log(`St.set_slow_down_factor() is deprecated, use St.Settings.slow_down_factor\n${stack}`);