From 7c108e267c75a502636a6e5ed07b306b88d193c2 Mon Sep 17 00:00:00 2001 From: Cosimo Cecchi Date: Thu, 12 Jan 2012 15:28:19 -0500 Subject: [PATCH] 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 --- js/ui/shellDBus.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/js/ui/shellDBus.js b/js/ui/shellDBus.js index 9dd8bccef..275d57b77 100644 --- a/js/ui/shellDBus.js +++ b/js/ui/shellDBus.js @@ -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() {