[gnome-shell] dbus: fix Screenshot async methods fallout from GDBus migration



commit 7c108e267c75a502636a6e5ed07b306b88d193c2
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Thu Jan 12 15:28:19 2012 -0500

    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 files changed, 14 insertions(+), 4 deletions(-)
---
diff --git a/js/ui/shellDBus.js b/js/ui/shellDBus.js
index 9dd8bcc..275d57b 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() {



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