dbus: fix Screenshot async methods fallout from GDBus migration

With GJS' GDBus implementation, we get the invocation paramters as an
array if we declare a method as async.
This is bad and not consistent with what GJS does for synchronous
methods, but it's the way it is, and other classes in gnome-shell
implement this correctly by exploding the array into its components in
the method implementation, but not the screenshot methods.
Also, we're supposed to return a value using the provided invocation
object, not with a callback now, so do that.

https://bugzilla.gnome.org/show_bug.cgi?id=667662
This commit is contained in:
Cosimo Cecchi 2012-01-12 15:28:19 -05:00
parent 5cf06fe9a7
commit 7c108e267c

View File

@ -122,8 +122,13 @@ const GnomeShell = new Lang.Class({
* indicating whether the operation was successful or not.
*
*/
ScreenshotAreaAsync : function (x, y, width, height, filename, callback) {
global.screenshot_area (x, y, width, height, filename, function (obj, result) { callback(result); });
ScreenshotAreaAsync : function (params, invocation) {
let [x, y, width, height, filename, callback] = params;
global.screenshot_area (x, y, width, height, filename,
function (obj, result) {
let retval = GLib.Variant.new('(b)', [result]);
invocation.return_value(retval);
});
},
/**
@ -149,8 +154,13 @@ const GnomeShell = new Lang.Class({
* indicating whether the operation was successful or not.
*
*/
ScreenshotAsync : function (filename, callback) {
global.screenshot(filename, function (obj, result) { callback(result); });
ScreenshotAsync : function (params, invocation) {
let [filename] = params;
global.screenshot(filename,
function (obj, result) {
let retval = GLib.Variant.new('(b)', [result]);
invocation.return_value(retval);
});
},
ListExtensions: function() {