[gjs/wip/gobj-kitchen-sink: 19/20] 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: 19/20] GDBus: Allow prefixing property names with 'DBus' to help prevent collisions
- Date: Fri, 3 Feb 2012 16:55:15 +0000 (UTC)
commit 0b3e492274502b722c1d9f7b45cb38d76f1cc815
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 e86a5e7..6928a5c 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 GLib.Variant.new(propInfo.signature, jsval);
else
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]