[gjs/wip/gobj-kitchen-sink: 24/26] GDBus: Allow automatic exporting of implementations on construction



commit 072b35186a68284a11c7d059ca7a5e8851b927e8
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Fri Jan 27 11:11:06 2012 -0500

    GDBus: Allow automatic exporting of implementations on construction
    
    If a DBusImplementerClass provides "BusType" and "ObjectPath" names
    in its parameters, export it automatically when an instance is
    constructed.

 modules/overrides/Gio.js |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/modules/overrides/Gio.js b/modules/overrides/Gio.js
index 0afc6b5..2e2e109 100644
--- a/modules/overrides/Gio.js
+++ b/modules/overrides/Gio.js
@@ -327,6 +327,12 @@ const DBusImplementerBase = new Lang.Class({
 	this._dbusImpl.connect('handle-method-call', Lang.bind(this, this._handleMethodCall));
 	this._dbusImpl.connect('handle-property-get', Lang.bind(this, this._handlePropertyGet));
 	this._dbusImpl.connect('handle-property-set', Lang.bind(this, this._handlePropertySet));
+
+        if (this.constructor.BusType && this.constructor.ObjectPath) {
+            let busType = this.constructor.BusType;
+            let objPath = this.constructor.ObjectPath;
+            this.export(Gio.bus_get_sync(busType, null), objPath);
+        }
     },
 
     _handleMethodCall: function(impl, method_name, parameters, invocation) {
@@ -454,6 +460,12 @@ const DBusImplementerClass = new Lang.Class({
 	this.Interface = params.Interface;
 	delete params.Interface;
 
+        this.BusType = params.BusType;
+        delete params.BusType;
+
+        this.ObjectPath = params.ObjectPath;
+        delete params.ObjectPath;
+
 	this.parent(params);
     }
 });



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