js: use ES6 template strings for dbus interfaces

Use multiline template strings for dbus interfaces as they're easier to maintain
This commit is contained in:
Marco Trevisan (Treviño)
2018-08-23 02:55:02 +02:00
parent f77b3da74f
commit dbf993300a
37 changed files with 1006 additions and 945 deletions

View File

@ -17,55 +17,57 @@ const Params = imports.misc.params;
const Util = imports.misc.util;
// Should really be defined in Gio.js
const BusIface = '<node> \
<interface name="org.freedesktop.DBus"> \
<method name="GetConnectionUnixProcessID"> \
<arg type="s" direction="in" /> \
<arg type="u" direction="out" /> \
</method> \
</interface> \
</node>';
const BusIface = `
<node>
<interface name="org.freedesktop.DBus">
<method name="GetConnectionUnixProcessID">
<arg type="s" direction="in" />
<arg type="u" direction="out" />
</method>
</interface>
</node>`;
var BusProxy = Gio.DBusProxy.makeProxyWrapper(BusIface);
function Bus() {
return new BusProxy(Gio.DBus.session, 'org.freedesktop.DBus', '/org/freedesktop/DBus');
}
const FdoNotificationsIface = '<node> \
<interface name="org.freedesktop.Notifications"> \
<method name="Notify"> \
<arg type="s" direction="in"/> \
<arg type="u" direction="in"/> \
<arg type="s" direction="in"/> \
<arg type="s" direction="in"/> \
<arg type="s" direction="in"/> \
<arg type="as" direction="in"/> \
<arg type="a{sv}" direction="in"/> \
<arg type="i" direction="in"/> \
<arg type="u" direction="out"/> \
</method> \
<method name="CloseNotification"> \
<arg type="u" direction="in"/> \
</method> \
<method name="GetCapabilities"> \
<arg type="as" direction="out"/> \
</method> \
<method name="GetServerInformation"> \
<arg type="s" direction="out"/> \
<arg type="s" direction="out"/> \
<arg type="s" direction="out"/> \
<arg type="s" direction="out"/> \
</method> \
<signal name="NotificationClosed"> \
<arg type="u"/> \
<arg type="u"/> \
</signal> \
<signal name="ActionInvoked"> \
<arg type="u"/> \
<arg type="s"/> \
</signal> \
</interface> \
</node>';
const FdoNotificationsIface = `
<node>
<interface name="org.freedesktop.Notifications">
<method name="Notify">
<arg type="s" direction="in"/>
<arg type="u" direction="in"/>
<arg type="s" direction="in"/>
<arg type="s" direction="in"/>
<arg type="s" direction="in"/>
<arg type="as" direction="in"/>
<arg type="a{sv}" direction="in"/>
<arg type="i" direction="in"/>
<arg type="u" direction="out"/>
</method>
<method name="CloseNotification">
<arg type="u" direction="in"/>
</method>
<method name="GetCapabilities">
<arg type="as" direction="out"/>
</method>
<method name="GetServerInformation">
<arg type="s" direction="out"/>
<arg type="s" direction="out"/>
<arg type="s" direction="out"/>
<arg type="s" direction="out"/>
</method>
<signal name="NotificationClosed">
<arg type="u"/>
<arg type="u"/>
</signal>
<signal name="ActionInvoked">
<arg type="u"/>
<arg type="s"/>
</signal>
</interface>
</node>`;
var NotificationClosedReason = {
EXPIRED: 1,
@ -654,18 +656,19 @@ var GtkNotificationDaemonNotification = new Lang.Class({
},
});
const FdoApplicationIface = '<node> \
<interface name="org.freedesktop.Application"> \
<method name="ActivateAction"> \
<arg type="s" direction="in" /> \
<arg type="av" direction="in" /> \
<arg type="a{sv}" direction="in" /> \
</method> \
<method name="Activate"> \
<arg type="a{sv}" direction="in" /> \
</method> \
</interface> \
</node>';
const FdoApplicationIface = `
<node>
<interface name="org.freedesktop.Application">
<method name="ActivateAction">
<arg type="s" direction="in" />
<arg type="av" direction="in" />
<arg type="a{sv}" direction="in" />
</method>
<method name="Activate">
<arg type="a{sv}" direction="in" />
</method>
</interface>
</node>`;
const FdoApplicationProxy = Gio.DBusProxy.makeProxyWrapper(FdoApplicationIface);
function objectPathFromAppId(appId) {
@ -774,19 +777,20 @@ var GtkNotificationDaemonAppSource = new Lang.Class({
},
});
const GtkNotificationsIface = '<node> \
<interface name="org.gtk.Notifications"> \
<method name="AddNotification"> \
<arg type="s" direction="in" /> \
<arg type="s" direction="in" /> \
<arg type="a{sv}" direction="in" /> \
</method> \
<method name="RemoveNotification"> \
<arg type="s" direction="in" /> \
<arg type="s" direction="in" /> \
</method> \
</interface> \
</node>';
const GtkNotificationsIface = `
<node>
<interface name="org.gtk.Notifications">
<method name="AddNotification">
<arg type="s" direction="in" />
<arg type="s" direction="in" />
<arg type="a{sv}" direction="in" />
</method>
<method name="RemoveNotification">
<arg type="s" direction="in" />
<arg type="s" direction="in" />
</method>
</interface>
</node>`;
var GtkNotificationDaemon = new Lang.Class({
Name: 'GtkNotificationDaemon',