[gjs/wip/gobj-kitchen-sink: 22/23] GDBus: Allow prefixing property names with 'DBus' to help prevent collisions
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs/wip/gobj-kitchen-sink: 22/23] GDBus: Allow prefixing property names with 'DBus' to help prevent collisions
- Date: Thu, 2 Feb 2012 22:09:51 +0000 (UTC)
commit 66d7835b83fb3af6a1937730eb51018fe7ea15e0
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Fri Jan 27 11:09:20 2012 -0500
GDBus: Allow prefixing property names with 'DBus' to help prevent collisions
Some implementers of DBus interfaces may be asked to implement properties
called 'Name' or 'Interface', which would collide with our own uses of
these functions. Allow these implementers to provide 'DBusName' or
'DBusInterface' instead.
modules/overrides/Gio.js | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/modules/overrides/Gio.js b/modules/overrides/Gio.js
index 6db07d7..cec7c9d 100644
--- a/modules/overrides/Gio.js
+++ b/modules/overrides/Gio.js
@@ -381,7 +381,14 @@ const DBusImplementerBase = new Lang.Class({
let klass = this.constructor;
let propInfo = klass.Interface.lookup_property(property_name);
- let jsval = this[property_name];
+
+ // Properties like "Name" may collide with regular class usage,
+ // so try prefixing with "DBus" first.
+ let jsval;
+ jsval = this['DBus' + property_name];
+ if (jsval === undefined)
+ jsval = this[property_name];
+
if (jsval != undefined)
return new GLib.Variant(propInfo.signature, jsval);
else
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]