[gjs/wip/gobj-kitchen-sink: 20/21] 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: 20/21] GDBus: Allow prefixing property names with 'DBus' to help prevent collisions
- Date: Fri, 27 Jan 2012 20:08:10 +0000 (UTC)
commit a160c0b28d970a6081341687400941172103bdd8
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..0afc6b5 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;
+ if (('DBus' + property_name) in this)
+ jsval = this['DBus' + property_name];
+ else
+ 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]