[gjs/wip/gobj-kitchen-sink: 23/26] 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: 23/26] GDBus: Allow prefixing property names with 'DBus' to help prevent collisions
- Date: Sat, 28 Jan 2012 09:05:28 +0000 (UTC)
commit fa080afbd77f3f144aa953aacbb26e8f1c129fb6
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]