[the-board/wip/http-api: 3/6] [ui] Add addThing DBus method to Application



commit 2edb328827f66b1c7777dc93006af4fcee077c56
Author: Lucas Rocha <lucasr gnome org>
Date:   Mon Nov 22 23:19:37 2010 +0000

    [ui] Add addThing DBus method to Application

 src/js/ui/application.js |   25 ++++++++++++++++++++++++-
 1 files changed, 24 insertions(+), 1 deletions(-)
---
diff --git a/src/js/ui/application.js b/src/js/ui/application.js
index f2ac8d4..6994ddb 100644
--- a/src/js/ui/application.js
+++ b/src/js/ui/application.js
@@ -19,7 +19,8 @@ const TheBoardIface = {
 
     methods: [ { name: "activate",
                  inSignature: '',
-                 outSignature: '' } ],
+                 outSignature: '' },
+               { name: "addThing" } ],
 
     signals: [],
 
@@ -98,6 +99,28 @@ Application.prototype = {
         this._mainWindow.present();
     },
 
+    // DBus method
+    addThing : function(args) {
+        log('Application: addThing via DBus');
+
+        if (!('thingId' in args)) {
+            log('Application: addThing needs a thingId argument');
+            return;
+        }
+
+        let thingId = args.thingId;
+
+        // Any extra values in args are considered as
+        // thing-specific arguments
+        delete args.thingId;
+        let thingArgs = args;
+
+        if (this._mainWindow.currentPage) {
+            this._mainWindow.currentPage.addThingFromId(thingId,
+                                                        thingArgs);
+        }
+    },
+
     quit : function() {
         Gtk.main_quit();
     }



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