[the-board] [ui] Add addThings DBus method to Application
- From: Lucas Rocha <lucasr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [the-board] [ui] Add addThings DBus method to Application
- Date: Sat, 27 Nov 2010 23:24:47 +0000 (UTC)
commit 731417520166d035254dc640850b0ab408d7b9f2
Author: Lucas Rocha <lucasr gnome org>
Date: Sat Nov 27 21:32:18 2010 +0000
[ui] Add addThings DBus method to Application
Useful to add multiple things at once remotely.
src/js/ui/application.js | 35 +++++++++++++++++++++++++++--------
1 files changed, 27 insertions(+), 8 deletions(-)
---
diff --git a/src/js/ui/application.js b/src/js/ui/application.js
index 24c5e14..c52738c 100644
--- a/src/js/ui/application.js
+++ b/src/js/ui/application.js
@@ -26,7 +26,10 @@ const TheBoardIface = {
methods: [ { name: "activate",
inSignature: '',
outSignature: '' },
- { name: "addThing" } ],
+ { name: "addThing" },
+ { name: "addThings",
+ inSignature: 'aa{sv}',
+ outSignature: '' } ],
signals: [],
@@ -92,6 +95,17 @@ Application.prototype = {
}
},
+ _addOneThing : function(args) {
+ if (!('id' in args)) {
+ log('Application: addThing(s) needs an id argument');
+ return;
+ }
+
+ if (this._mainWindow.currentPage) {
+ this._mainWindow.currentPage.addThingFromState(args);
+ }
+ },
+
_onNameAcquired : function() {
log('Application: acquired ' + TheBoardIface.name);
@@ -126,15 +140,20 @@ Application.prototype = {
addThing : function(args) {
log('Application: addThing via DBus');
- if (!('id' in args)) {
- log('Application: addThing needs an id argument');
- return;
- }
+ this._addOneThing(args);
- if (this._mainWindow.currentPage) {
- this._mainWindow.currentPage.addThingFromState(args);
- this._showNotification(Gettext.gettext("Added to The Board"));
+ this._showNotification(Gettext.gettext("Added to The Board"));
+ },
+
+ // DBus method
+ addThings : function(things) {
+ log('Application: addThings via DBus');
+
+ for (let i = 0; i < things.length; ++i) {
+ this._addOneThing(things[i]);
}
+
+ this._showNotification(Gettext.gettext("Added to The Board"));
},
quit : function() {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]