[gnome-shell] shell-dbus: factor screenshot callback into a separate function
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] shell-dbus: factor screenshot callback into a separate function
- Date: Thu, 26 Jan 2012 00:20:22 +0000 (UTC)
commit ef56a7854436340e786a32c56ba0a4b7018a9b96
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Wed Jan 25 10:46:30 2012 -0500
shell-dbus: factor screenshot callback into a separate function
Share the screenshot methods callback into a factored out function.
https://bugzilla.gnome.org/show_bug.cgi?id=668618
js/ui/shellDBus.js | 35 +++++++++++++----------------------
1 files changed, 13 insertions(+), 22 deletions(-)
---
diff --git a/js/ui/shellDBus.js b/js/ui/shellDBus.js
index 63d9101..779a173 100644
--- a/js/ui/shellDBus.js
+++ b/js/ui/shellDBus.js
@@ -113,11 +113,14 @@ const GnomeShell = new Lang.Class({
return [success, returnValue];
},
- _handleScreenshotFlash: function(flash, area) {
+ _onScreenshotComplete: function(obj, result, area, flash, invocation) {
if (flash) {
let flashspot = new Flashspot.Flashspot(area);
flashspot.fire();
}
+
+ let retval = GLib.Variant.new('(b)', [result]);
+ invocation.return_value(retval);
},
/**
@@ -135,13 +138,9 @@ const GnomeShell = new Lang.Class({
*/
ScreenshotAreaAsync : function (params, invocation) {
let [x, y, width, height, flash, filename, callback] = params;
- global.screenshot_area (x, y, width, height, filename, Lang.bind(this,
- function (obj, result, area) {
- this._handleScreenshotFlash(flash, area);
-
- let retval = GLib.Variant.new('(b)', [result]);
- invocation.return_value(retval);
- }));
+ global.screenshot_area (x, y, width, height, filename,
+ Lang.bind(this, this._onScreenshotComplete,
+ flash, invocation));
},
/**
@@ -156,13 +155,9 @@ const GnomeShell = new Lang.Class({
*/
ScreenshotWindowAsync : function (params, invocation) {
let [include_frame, flash, filename] = params;
- global.screenshot_window (include_frame, filename, Lang.bind(this,
- function (obj, result, area) {
- this._handleScreenshotFlash(flash, area);
-
- let retval = GLib.Variant.new('(b)', [result]);
- invocation.return_value(retval);
- }));
+ global.screenshot_window (include_frame, filename,
+ Lang.bind(this, this._onScreenshotComplete,
+ flash, invocation));
},
/**
@@ -176,13 +171,9 @@ const GnomeShell = new Lang.Class({
*/
ScreenshotAsync : function (params, invocation) {
let [flash, filename] = params;
- global.screenshot(filename, Lang.bind(this,
- function (obj, result, area) {
- this._handleScreenshotFlash(flash, area);
-
- let retval = GLib.Variant.new('(b)', [result]);
- invocation.return_value(retval);
- }));
+ global.screenshot(filename,
+ Lang.bind(this, this._onScreenshotComplete,
+ flash, invocation));
},
ListExtensions: function() {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]